Mercurial > hg > truffle
annotate src/share/vm/compiler/compileBroker.cpp @ 14714:b602356a9cfc
additional canonicalizers for accesses and value nodes (improves number of implicit null checks)
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Thu, 20 Mar 2014 17:15:36 +0100 |
parents | 10c4df6767c4 |
children | 4ca6dc0799b6 |
rev | line source |
---|---|
0 | 1 /* |
10405 | 2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1538
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1538
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1538
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "classfile/systemDictionary.hpp" | |
27 #include "classfile/vmSymbols.hpp" | |
28 #include "code/codeCache.hpp" | |
29 #include "compiler/compileBroker.hpp" | |
30 #include "compiler/compileLog.hpp" | |
31 #include "compiler/compilerOracle.hpp" | |
32 #include "interpreter/linkResolver.hpp" | |
33 #include "memory/allocation.inline.hpp" | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
34 #include "oops/methodData.hpp" |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
35 #include "oops/method.hpp" |
1972 | 36 #include "oops/oop.inline.hpp" |
37 #include "prims/nativeLookup.hpp" | |
38 #include "runtime/arguments.hpp" | |
39 #include "runtime/compilationPolicy.hpp" | |
40 #include "runtime/init.hpp" | |
41 #include "runtime/interfaceSupport.hpp" | |
42 #include "runtime/javaCalls.hpp" | |
43 #include "runtime/os.hpp" | |
44 #include "runtime/sharedRuntime.hpp" | |
45 #include "runtime/sweeper.hpp" | |
10405 | 46 #include "trace/tracing.hpp" |
1972 | 47 #include "utilities/dtrace.hpp" |
4872
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
48 #include "utilities/events.hpp" |
1972 | 49 #ifdef COMPILER1 |
50 #include "c1/c1_Compiler.hpp" | |
51 #endif | |
7125
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
6948
diff
changeset
|
52 #ifdef GRAAL |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
6948
diff
changeset
|
53 #include "graal/graalCompiler.hpp" |
1baf7f1e3f23
decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents:
6948
diff
changeset
|
54 #endif |
1972 | 55 #ifdef COMPILER2 |
56 #include "opto/c2compiler.hpp" | |
57 #endif | |
58 #ifdef SHARK | |
59 #include "shark/sharkCompiler.hpp" | |
60 #endif | |
0 | 61 |
62 #ifdef DTRACE_ENABLED | |
63 | |
64 // Only bother with this argument setup if dtrace is available | |
65 | |
10207
e4e131b15d5c
8013532: Remove unused parameter "compiler" from DTRACE_METHOD_COMPILE* macros
roland
parents:
10206
diff
changeset
|
66 #define DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, comp_name) \ |
4006 | 67 { \ |
68 Symbol* klass_name = (method)->klass_name(); \ | |
69 Symbol* name = (method)->name(); \ | |
70 Symbol* signature = (method)->signature(); \ | |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
71 HOTSPOT_METHOD_COMPILE_BEGIN( \ |
14278
a3ba776d6ab6
8030812: Change the solaris DTrace implementation to use USDT2 instead of USDT1
sla
parents:
14236
diff
changeset
|
72 (char *) comp_name, strlen(comp_name), \ |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
73 (char *) klass_name->bytes(), klass_name->utf8_length(), \ |
4006 | 74 (char *) name->bytes(), name->utf8_length(), \ |
75 (char *) signature->bytes(), signature->utf8_length()); \ | |
76 } | |
77 | |
10207
e4e131b15d5c
8013532: Remove unused parameter "compiler" from DTRACE_METHOD_COMPILE* macros
roland
parents:
10206
diff
changeset
|
78 #define DTRACE_METHOD_COMPILE_END_PROBE(method, comp_name, success) \ |
4006 | 79 { \ |
80 Symbol* klass_name = (method)->klass_name(); \ | |
81 Symbol* name = (method)->name(); \ | |
82 Symbol* signature = (method)->signature(); \ | |
83 HOTSPOT_METHOD_COMPILE_END( \ | |
14278
a3ba776d6ab6
8030812: Change the solaris DTrace implementation to use USDT2 instead of USDT1
sla
parents:
14236
diff
changeset
|
84 (char *) comp_name, strlen(comp_name), \ |
4006 | 85 (char *) klass_name->bytes(), klass_name->utf8_length(), \ |
86 (char *) name->bytes(), name->utf8_length(), \ | |
87 (char *) signature->bytes(), signature->utf8_length(), (success)); \ | |
88 } | |
89 | |
0 | 90 #else // ndef DTRACE_ENABLED |
91 | |
10207
e4e131b15d5c
8013532: Remove unused parameter "compiler" from DTRACE_METHOD_COMPILE* macros
roland
parents:
10206
diff
changeset
|
92 #define DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, comp_name) |
e4e131b15d5c
8013532: Remove unused parameter "compiler" from DTRACE_METHOD_COMPILE* macros
roland
parents:
10206
diff
changeset
|
93 #define DTRACE_METHOD_COMPILE_END_PROBE(method, comp_name, success) |
0 | 94 |
95 #endif // ndef DTRACE_ENABLED | |
96 | |
97 bool CompileBroker::_initialized = false; | |
98 volatile bool CompileBroker::_should_block = false; | |
13074
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
99 volatile jint CompileBroker::_print_compilation_warning = 0; |
1202 | 100 volatile jint CompileBroker::_should_compile_new_jobs = run_compilation; |
0 | 101 |
102 // The installed compiler(s) | |
103 AbstractCompiler* CompileBroker::_compilers[2]; | |
104 | |
14236 | 105 // These counters are used to assign an unique ID to each compilation. |
106 volatile jint CompileBroker::_compilation_id = 0; | |
107 volatile jint CompileBroker::_osr_compilation_id = 0; | |
0 | 108 |
109 // Debugging information | |
110 int CompileBroker::_last_compile_type = no_compile; | |
111 int CompileBroker::_last_compile_level = CompLevel_none; | |
112 char CompileBroker::_last_method_compiled[CompileBroker::name_buffer_length]; | |
113 | |
114 // Performance counters | |
115 PerfCounter* CompileBroker::_perf_total_compilation = NULL; | |
116 PerfCounter* CompileBroker::_perf_osr_compilation = NULL; | |
117 PerfCounter* CompileBroker::_perf_standard_compilation = NULL; | |
118 | |
119 PerfCounter* CompileBroker::_perf_total_bailout_count = NULL; | |
120 PerfCounter* CompileBroker::_perf_total_invalidated_count = NULL; | |
121 PerfCounter* CompileBroker::_perf_total_compile_count = NULL; | |
122 PerfCounter* CompileBroker::_perf_total_osr_compile_count = NULL; | |
123 PerfCounter* CompileBroker::_perf_total_standard_compile_count = NULL; | |
124 | |
125 PerfCounter* CompileBroker::_perf_sum_osr_bytes_compiled = NULL; | |
126 PerfCounter* CompileBroker::_perf_sum_standard_bytes_compiled = NULL; | |
127 PerfCounter* CompileBroker::_perf_sum_nmethod_size = NULL; | |
128 PerfCounter* CompileBroker::_perf_sum_nmethod_code_size = NULL; | |
129 | |
130 PerfStringVariable* CompileBroker::_perf_last_method = NULL; | |
131 PerfStringVariable* CompileBroker::_perf_last_failed_method = NULL; | |
132 PerfStringVariable* CompileBroker::_perf_last_invalidated_method = NULL; | |
133 PerfVariable* CompileBroker::_perf_last_compile_type = NULL; | |
134 PerfVariable* CompileBroker::_perf_last_compile_size = NULL; | |
135 PerfVariable* CompileBroker::_perf_last_failed_type = NULL; | |
136 PerfVariable* CompileBroker::_perf_last_invalidated_type = NULL; | |
137 | |
138 // Timers and counters for generating statistics | |
139 elapsedTimer CompileBroker::_t_total_compilation; | |
140 elapsedTimer CompileBroker::_t_osr_compilation; | |
141 elapsedTimer CompileBroker::_t_standard_compilation; | |
142 | |
143 int CompileBroker::_total_bailout_count = 0; | |
144 int CompileBroker::_total_invalidated_count = 0; | |
145 int CompileBroker::_total_compile_count = 0; | |
146 int CompileBroker::_total_osr_compile_count = 0; | |
147 int CompileBroker::_total_standard_compile_count = 0; | |
148 | |
149 int CompileBroker::_sum_osr_bytes_compiled = 0; | |
150 int CompileBroker::_sum_standard_bytes_compiled = 0; | |
151 int CompileBroker::_sum_nmethod_size = 0; | |
152 int CompileBroker::_sum_nmethod_code_size = 0; | |
153 | |
10405 | 154 long CompileBroker::_peak_compilation_time = 0; |
155 | |
156 CompileQueue* CompileBroker::_c2_method_queue = NULL; | |
157 CompileQueue* CompileBroker::_c1_method_queue = NULL; | |
158 CompileTask* CompileBroker::_task_free_list = NULL; | |
0 | 159 |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
160 GrowableArray<CompilerThread*>* CompileBroker::_compiler_threads = NULL; |
0 | 161 |
162 | |
4872
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
163 class CompilationLog : public StringEventLog { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
164 public: |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
165 CompilationLog() : StringEventLog("Compilation events") { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
166 } |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
167 |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
168 void log_compile(JavaThread* thread, CompileTask* task) { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
169 StringLogMessage lm; |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
170 stringStream sstr = lm.stream(); |
4872
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
171 // msg.time_stamp().update_to(tty->time_stamp().ticks()); |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
172 task->print_compilation(&sstr, NULL, true); |
4872
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
173 log(thread, "%s", (const char*)lm); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
174 } |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
175 |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
176 void log_nmethod(JavaThread* thread, nmethod* nm) { |
4944 | 177 log(thread, "nmethod %d%s " INTPTR_FORMAT " code ["INTPTR_FORMAT ", " INTPTR_FORMAT "]", |
178 nm->compile_id(), nm->is_osr_method() ? "%" : "", | |
4872
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
179 nm, nm->code_begin(), nm->code_end()); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
180 } |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
181 |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
182 void log_failure(JavaThread* thread, CompileTask* task, const char* reason, const char* retry_message) { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
183 StringLogMessage lm; |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
184 lm.print("%4d COMPILE SKIPPED: %s", task->compile_id(), reason); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
185 if (retry_message != NULL) { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
186 lm.append(" (%s)", retry_message); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
187 } |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
188 lm.print("\n"); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
189 log(thread, "%s", (const char*)lm); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
190 } |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
191 }; |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
192 |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
193 static CompilationLog* _compilation_log = NULL; |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
194 |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
195 void compileBroker_init() { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
196 if (LogEvents) { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
197 _compilation_log = new CompilationLog(); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
198 } |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
199 } |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
200 |
0 | 201 CompileTaskWrapper::CompileTaskWrapper(CompileTask* task) { |
202 CompilerThread* thread = CompilerThread::current(); | |
203 thread->set_task(task); | |
204 CompileLog* log = thread->log(); | |
205 if (log != NULL) task->log_task_start(log); | |
206 } | |
207 | |
208 CompileTaskWrapper::~CompileTaskWrapper() { | |
209 CompilerThread* thread = CompilerThread::current(); | |
210 CompileTask* task = thread->task(); | |
211 CompileLog* log = thread->log(); | |
212 if (log != NULL) task->log_task_done(log); | |
213 thread->set_task(NULL); | |
214 task->set_code_handle(NULL); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
215 thread->set_env(NULL); |
0 | 216 if (task->is_blocking()) { |
217 MutexLocker notifier(task->lock(), thread); | |
218 task->mark_complete(); | |
219 // Notify the waiting thread that the compilation has completed. | |
220 task->lock()->notify_all(); | |
221 } else { | |
222 task->mark_complete(); | |
223 | |
224 // By convention, the compiling thread is responsible for | |
225 // recycling a non-blocking CompileTask. | |
226 CompileBroker::free_task(task); | |
227 } | |
228 } | |
229 | |
230 | |
231 // ------------------------------------------------------------------ | |
232 // CompileTask::initialize | |
233 void CompileTask::initialize(int compile_id, | |
234 methodHandle method, | |
235 int osr_bci, | |
236 int comp_level, | |
237 methodHandle hot_method, | |
238 int hot_count, | |
239 const char* comment, | |
240 bool is_blocking) { | |
241 assert(!_lock->is_locked(), "bad locking"); | |
242 | |
243 _compile_id = compile_id; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
244 _method = method(); |
7409 | 245 _method_holder = JNIHandles::make_global(method->method_holder()->klass_holder()); |
0 | 246 _osr_bci = osr_bci; |
247 _is_blocking = is_blocking; | |
248 _comp_level = comp_level; | |
249 _num_inlined_bytecodes = 0; | |
250 | |
251 _is_complete = false; | |
252 _is_success = false; | |
253 _code_handle = NULL; | |
254 | |
255 _hot_method = NULL; | |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6940
diff
changeset
|
256 _hot_method_holder = NULL; |
0 | 257 _hot_count = hot_count; |
258 _time_queued = 0; // tidy | |
259 _comment = comment; | |
260 | |
261 if (LogCompilation) { | |
262 _time_queued = os::elapsed_counter(); | |
263 if (hot_method.not_null()) { | |
264 if (hot_method == method) { | |
265 _hot_method = _method; | |
266 } else { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
267 _hot_method = hot_method(); |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6940
diff
changeset
|
268 // only add loader or mirror if different from _method_holder |
7409 | 269 _hot_method_holder = JNIHandles::make_global(hot_method->method_holder()->klass_holder()); |
0 | 270 } |
271 } | |
272 } | |
273 | |
274 _next = NULL; | |
275 } | |
276 | |
277 // ------------------------------------------------------------------ | |
278 // CompileTask::code/set_code | |
279 nmethod* CompileTask::code() const { | |
280 if (_code_handle == NULL) return NULL; | |
281 return _code_handle->code(); | |
282 } | |
283 void CompileTask::set_code(nmethod* nm) { | |
284 if (_code_handle == NULL && nm == NULL) return; | |
285 guarantee(_code_handle != NULL, ""); | |
286 _code_handle->set_code(nm); | |
287 if (nm == NULL) _code_handle = NULL; // drop the handle also | |
288 } | |
289 | |
290 // ------------------------------------------------------------------ | |
291 // CompileTask::free | |
292 void CompileTask::free() { | |
293 set_code(NULL); | |
294 assert(!_lock->is_locked(), "Should not be locked when freed"); | |
7185
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6940
diff
changeset
|
295 JNIHandles::destroy_global(_method_holder); |
90273fc0a981
8000662: NPG: nashorn ant clean test262 out-of-memory with Java heap
coleenp
parents:
6940
diff
changeset
|
296 JNIHandles::destroy_global(_hot_method_holder); |
0 | 297 } |
298 | |
299 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
300 void CompileTask::mark_on_stack() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
301 // Mark these methods as something redefine classes cannot remove. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
302 _method->set_on_stack(true); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
303 if (_hot_method != NULL) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
304 _hot_method->set_on_stack(true); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
305 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
306 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
307 |
0 | 308 // ------------------------------------------------------------------ |
309 // CompileTask::print | |
310 void CompileTask::print() { | |
311 tty->print("<CompileTask compile_id=%d ", _compile_id); | |
312 tty->print("method="); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
313 _method->print_name(tty); |
0 | 314 tty->print_cr(" osr_bci=%d is_blocking=%s is_complete=%s is_success=%s>", |
315 _osr_bci, bool_to_str(_is_blocking), | |
316 bool_to_str(_is_complete), bool_to_str(_is_success)); | |
317 } | |
318 | |
1783 | 319 |
0 | 320 // ------------------------------------------------------------------ |
321 // CompileTask::print_line_on_error | |
322 // | |
323 // This function is called by fatal error handler when the thread | |
324 // causing troubles is a compiler thread. | |
325 // | |
326 // Do not grab any lock, do not allocate memory. | |
327 // | |
328 // Otherwise it's the same as CompileTask::print_line() | |
329 // | |
330 void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) { | |
331 // print compiler name | |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
332 st->print("%s:", CompileBroker::compiler_name(comp_level())); |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
333 print_compilation(st); |
0 | 334 } |
335 | |
336 // ------------------------------------------------------------------ | |
337 // CompileTask::print_line | |
338 void CompileTask::print_line() { | |
339 ttyLocker ttyl; // keep the following output all in one block | |
340 // print compiler name if requested | |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
341 if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler_name(comp_level())); |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
342 print_compilation(); |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
343 } |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
344 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
345 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
346 // ------------------------------------------------------------------ |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
347 // CompileTask::print_compilation_impl |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
348 void CompileTask::print_compilation_impl(outputStream* st, Method* method, int compile_id, int comp_level, |
4872
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
349 bool is_osr_method, int osr_bci, bool is_blocking, |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
350 const char* msg, bool short_form) { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
351 if (!short_form) { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
352 st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
353 } |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
354 st->print("%4d ", compile_id); // print compilation number |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
355 |
3441
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
356 // For unloaded methods the transition to zombie occurs after the |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
357 // method is cleared so it's impossible to report accurate |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
358 // information for that case. |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
359 bool is_synchronized = false; |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
360 bool has_exception_handler = false; |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
361 bool is_native = false; |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
362 if (method != NULL) { |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
363 is_synchronized = method->is_synchronized(); |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
364 has_exception_handler = method->has_exception_handler(); |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
365 is_native = method->is_native(); |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
366 } |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
367 // method attributes |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
368 const char compile_type = is_osr_method ? '%' : ' '; |
3441
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
369 const char sync_char = is_synchronized ? 's' : ' '; |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
370 const char exception_char = has_exception_handler ? '!' : ' '; |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
371 const char blocking_char = is_blocking ? 'b' : ' '; |
3441
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
372 const char native_char = is_native ? 'n' : ' '; |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
373 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
374 // print method attributes |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
375 st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char); |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
376 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
377 if (TieredCompilation) { |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
378 if (comp_level != -1) st->print("%d ", comp_level); |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
379 else st->print("- "); |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
380 } |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
381 st->print(" "); // more indent |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
382 |
3441
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
383 if (method == NULL) { |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
384 st->print("(method)"); |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
385 } else { |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
386 method->print_short_name(st); |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
387 if (is_osr_method) { |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
388 st->print(" @ %d", osr_bci); |
f56542cb325a
7050554: JSR 292 - need optimization for selectAlternative
never
parents:
3294
diff
changeset
|
389 } |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
390 if (method->is_native()) |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
391 st->print(" (native)"); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
392 else |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
393 st->print(" (%d bytes)", method->code_size()); |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
394 } |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
395 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
396 if (msg != NULL) { |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
397 st->print(" %s", msg); |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
398 } |
4872
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
399 if (!short_form) { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
400 st->cr(); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
401 } |
0 | 402 } |
403 | |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
404 // ------------------------------------------------------------------ |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
405 // CompileTask::print_inlining |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
406 void CompileTask::print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg) { |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
407 // 1234567 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
408 st->print(" "); // print timestamp |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
409 // 1234 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
410 st->print(" "); // print compilation number |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
411 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
412 // method attributes |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
413 if (method->is_loaded()) { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
414 const char sync_char = method->is_synchronized() ? 's' : ' '; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
415 const char exception_char = method->has_exception_handlers() ? '!' : ' '; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
416 const char monitors_char = method->has_monitor_bytecodes() ? 'm' : ' '; |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
417 |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
418 // print method attributes |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
419 st->print(" %c%c%c ", sync_char, exception_char, monitors_char); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
420 } else { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
421 // %s!bn |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
422 st->print(" "); // print method attributes |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
423 } |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
424 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
425 if (TieredCompilation) { |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
426 st->print(" "); |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
427 } |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
428 st->print(" "); // more indent |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
429 st->print(" "); // initial inlining indent |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
430 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
431 for (int i = 0; i < inline_level; i++) st->print(" "); |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
432 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
433 st->print("@ %d ", bci); // print bci |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
434 method->print_short_name(st); |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
435 if (method->is_loaded()) |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
436 st->print(" (%d bytes)", method->code_size()); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
437 else |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
438 st->print(" (not loaded)"); |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
439 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
440 if (msg != NULL) { |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
441 st->print(" %s", msg); |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
442 } |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
443 st->cr(); |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
444 } |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
445 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
446 // ------------------------------------------------------------------ |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
447 // CompileTask::print_inline_indent |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
448 void CompileTask::print_inline_indent(int inline_level, outputStream* st) { |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
449 // 1234567 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
450 st->print(" "); // print timestamp |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
451 // 1234 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
452 st->print(" "); // print compilation number |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
453 // %s!bn |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
454 st->print(" "); // print method attributes |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
455 if (TieredCompilation) { |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
456 st->print(" "); |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
457 } |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
458 st->print(" "); // more indent |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
459 st->print(" "); // initial inlining indent |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
460 for (int i = 0; i < inline_level; i++) st->print(" "); |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
461 } |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
462 |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
463 // ------------------------------------------------------------------ |
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
464 // CompileTask::print_compilation |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
465 void CompileTask::print_compilation(outputStream* st, const char* msg, bool short_form) { |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
466 bool is_osr_method = osr_bci() != InvocationEntryBci; |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
467 print_compilation_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form); |
2405
3d58a4983660
7022998: JSR 292 recursive method handle calls inline themselves infinitely
twisti
parents:
2403
diff
changeset
|
468 } |
0 | 469 |
470 // ------------------------------------------------------------------ | |
471 // CompileTask::log_task | |
472 void CompileTask::log_task(xmlStream* log) { | |
473 Thread* thread = Thread::current(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
474 methodHandle method(thread, this->method()); |
0 | 475 ResourceMark rm(thread); |
476 | |
477 // <task id='9' method='M' osr_bci='X' level='1' blocking='1' stamp='1.234'> | |
8730
b7c2c5b2572c
8005772: Stubs report compile id -1 in phase events
neliasso
parents:
7998
diff
changeset
|
478 log->print(" compile_id='%d'", _compile_id); |
0 | 479 if (_osr_bci != CompileBroker::standard_entry_bci) { |
480 log->print(" compile_kind='osr'"); // same as nmethod::compile_kind | |
481 } // else compile_kind='c2c' | |
482 if (!method.is_null()) log->method(method); | |
483 if (_osr_bci != CompileBroker::standard_entry_bci) { | |
484 log->print(" osr_bci='%d'", _osr_bci); | |
485 } | |
486 if (_comp_level != CompLevel_highest_tier) { | |
487 log->print(" level='%d'", _comp_level); | |
488 } | |
489 if (_is_blocking) { | |
490 log->print(" blocking='1'"); | |
491 } | |
492 log->stamp(); | |
493 } | |
494 | |
495 | |
496 // ------------------------------------------------------------------ | |
497 // CompileTask::log_task_queued | |
498 void CompileTask::log_task_queued() { | |
499 Thread* thread = Thread::current(); | |
500 ttyLocker ttyl; | |
501 ResourceMark rm(thread); | |
502 | |
503 xtty->begin_elem("task_queued"); | |
504 log_task(xtty); | |
505 if (_comment != NULL) { | |
506 xtty->print(" comment='%s'", _comment); | |
507 } | |
508 if (_hot_method != NULL) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
509 methodHandle hot(thread, _hot_method); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
510 methodHandle method(thread, _method); |
0 | 511 if (hot() != method()) { |
512 xtty->method(hot); | |
513 } | |
514 } | |
515 if (_hot_count != 0) { | |
516 xtty->print(" hot_count='%d'", _hot_count); | |
517 } | |
518 xtty->end_elem(); | |
519 } | |
520 | |
521 | |
522 // ------------------------------------------------------------------ | |
523 // CompileTask::log_task_start | |
524 void CompileTask::log_task_start(CompileLog* log) { | |
525 log->begin_head("task"); | |
526 log_task(log); | |
527 log->end_head(); | |
528 } | |
529 | |
530 | |
531 // ------------------------------------------------------------------ | |
532 // CompileTask::log_task_done | |
533 void CompileTask::log_task_done(CompileLog* log) { | |
534 Thread* thread = Thread::current(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
535 methodHandle method(thread, this->method()); |
0 | 536 ResourceMark rm(thread); |
537 | |
538 // <task_done ... stamp='1.234'> </task> | |
539 nmethod* nm = code(); | |
540 log->begin_elem("task_done success='%d' nmsize='%d' count='%d'", | |
1748 | 541 _is_success, nm == NULL ? 0 : nm->content_size(), |
0 | 542 method->invocation_count()); |
543 int bec = method->backedge_count(); | |
544 if (bec != 0) log->print(" backedge_count='%d'", bec); | |
545 // Note: "_is_complete" is about to be set, but is not. | |
546 if (_num_inlined_bytecodes != 0) { | |
547 log->print(" inlined_bytes='%d'", _num_inlined_bytecodes); | |
548 } | |
549 log->stamp(); | |
550 log->end_elem(); | |
551 log->tail("task"); | |
552 log->clear_identities(); // next task will have different CI | |
553 if (log->unflushed_count() > 2000) { | |
554 log->flush(); | |
555 } | |
556 log->mark_file_end(); | |
557 } | |
558 | |
559 | |
560 | |
561 // Add a CompileTask to a CompileQueue | |
562 void CompileQueue::add(CompileTask* task) { | |
563 assert(lock()->owned_by_self(), "must own lock"); | |
564 | |
565 task->set_next(NULL); | |
1783 | 566 task->set_prev(NULL); |
0 | 567 |
568 if (_last == NULL) { | |
569 // The compile queue is empty. | |
570 assert(_first == NULL, "queue is empty"); | |
571 _first = task; | |
572 _last = task; | |
573 } else { | |
574 // Append the task to the queue. | |
575 assert(_last->next() == NULL, "not last"); | |
576 _last->set_next(task); | |
1783 | 577 task->set_prev(_last); |
0 | 578 _last = task; |
579 } | |
1783 | 580 ++_size; |
0 | 581 |
582 // Mark the method as being in the compile queue. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
583 task->method()->set_queued_for_compilation(); |
0 | 584 |
585 if (CIPrintCompileQueue) { | |
586 print(); | |
587 } | |
588 | |
589 if (LogCompilation && xtty != NULL) { | |
590 task->log_task_queued(); | |
591 } | |
592 | |
593 // Notify CompilerThreads that a task is available. | |
1783 | 594 lock()->notify_all(); |
0 | 595 } |
596 | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
597 void CompileQueue::delete_all() { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
598 assert(lock()->owned_by_self(), "must own lock"); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
599 if (_first != NULL) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
600 for (CompileTask* task = _first; task != NULL; task = task->next()) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
601 delete task; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
602 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
603 _first = NULL; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
604 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
605 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
606 |
0 | 607 // ------------------------------------------------------------------ |
608 // CompileQueue::get | |
609 // | |
610 // Get the next CompileTask from a CompileQueue | |
611 CompileTask* CompileQueue::get() { | |
1538
bfe29ec02863
6950075: nmethod sweeper should operate concurrently
never
parents:
1353
diff
changeset
|
612 NMethodSweeper::possibly_sweep(); |
bfe29ec02863
6950075: nmethod sweeper should operate concurrently
never
parents:
1353
diff
changeset
|
613 |
0 | 614 MutexLocker locker(lock()); |
12324
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
615 // If _first is NULL we have no more compile jobs. There are two reasons for |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
616 // having no compile jobs: First, we compiled everything we wanted. Second, |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
617 // we ran out of code cache so compilation has been disabled. In the latter |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
618 // case we perform code cache sweeps to free memory such that we can re-enable |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
619 // compilation. |
0 | 620 while (_first == NULL) { |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
621 // Exit loop if compilation is disabled forever |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
622 if (CompileBroker::is_compilation_disabled_forever()) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
623 return NULL; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
624 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
625 |
12324
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
626 if (UseCodeCacheFlushing && !CompileBroker::should_compile_new_jobs()) { |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
627 // Wait a certain amount of time to possibly do another sweep. |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
628 // We must wait until stack scanning has happened so that we can |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
629 // transition a method's state from 'not_entrant' to 'zombie'. |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
630 long wait_time = NmethodSweepCheckInterval * 1000; |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
631 if (FLAG_IS_DEFAULT(NmethodSweepCheckInterval)) { |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
632 // Only one thread at a time can do sweeping. Scale the |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
633 // wait time according to the number of compiler threads. |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
634 // As a result, the next sweep is likely to happen every 100ms |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
635 // with an arbitrary number of threads that do sweeping. |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
636 wait_time = 100 * CICompilerCount; |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
637 } |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
638 bool timeout = lock()->wait(!Mutex::_no_safepoint_check_flag, wait_time); |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
639 if (timeout) { |
1538
bfe29ec02863
6950075: nmethod sweeper should operate concurrently
never
parents:
1353
diff
changeset
|
640 MutexUnlocker ul(lock()); |
bfe29ec02863
6950075: nmethod sweeper should operate concurrently
never
parents:
1353
diff
changeset
|
641 NMethodSweeper::possibly_sweep(); |
bfe29ec02863
6950075: nmethod sweeper should operate concurrently
never
parents:
1353
diff
changeset
|
642 } |
bfe29ec02863
6950075: nmethod sweeper should operate concurrently
never
parents:
1353
diff
changeset
|
643 } else { |
12324
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
644 // If there are no compilation tasks and we can compile new jobs |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
645 // (i.e., there is enough free space in the code cache) there is |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
646 // no need to invoke the sweeper. As a result, the hotness of methods |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
647 // remains unchanged. This behavior is desired, since we want to keep |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
648 // the stable state, i.e., we do not want to evict methods from the |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
649 // code cache if it is unnecessary. |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
650 // We need a timed wait here, since compiler threads can exit if compilation |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
651 // is disabled forever. We use 5 seconds wait time; the exiting of compiler threads |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
652 // is not critical and we do not want idle compiler threads to wake up too often. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
653 lock()->wait(!Mutex::_no_safepoint_check_flag, 5*1000); |
1538
bfe29ec02863
6950075: nmethod sweeper should operate concurrently
never
parents:
1353
diff
changeset
|
654 } |
0 | 655 } |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
656 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
657 if (CompileBroker::is_compilation_disabled_forever()) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
658 return NULL; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
659 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
660 |
1783 | 661 CompileTask* task = CompilationPolicy::policy()->select_task(this); |
662 remove(task); | |
663 return task; | |
664 } | |
0 | 665 |
1783 | 666 void CompileQueue::remove(CompileTask* task) |
667 { | |
668 assert(lock()->owned_by_self(), "must own lock"); | |
669 if (task->prev() != NULL) { | |
670 task->prev()->set_next(task->next()); | |
671 } else { | |
672 // max is the first element | |
673 assert(task == _first, "Sanity"); | |
674 _first = task->next(); | |
0 | 675 } |
676 | |
1783 | 677 if (task->next() != NULL) { |
678 task->next()->set_prev(task->prev()); | |
679 } else { | |
680 // max is the last element | |
681 assert(task == _last, "Sanity"); | |
682 _last = task->prev(); | |
683 } | |
684 --_size; | |
0 | 685 } |
686 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
687 // methods in the compile queue need to be marked as used on the stack |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
688 // so that they don't get reclaimed by Redefine Classes |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
689 void CompileQueue::mark_on_stack() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
690 CompileTask* task = _first; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
691 while (task != NULL) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
692 task->mark_on_stack(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
693 task = task->next(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
694 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
695 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
696 |
0 | 697 // ------------------------------------------------------------------ |
698 // CompileQueue::print | |
699 void CompileQueue::print() { | |
700 tty->print_cr("Contents of %s", name()); | |
701 tty->print_cr("----------------------"); | |
702 CompileTask* task = _first; | |
703 while (task != NULL) { | |
704 task->print_line(); | |
705 task = task->next(); | |
706 } | |
707 tty->print_cr("----------------------"); | |
708 } | |
709 | |
710 CompilerCounters::CompilerCounters(const char* thread_name, int instance, TRAPS) { | |
711 | |
712 _current_method[0] = '\0'; | |
713 _compile_type = CompileBroker::no_compile; | |
714 | |
715 if (UsePerfData) { | |
716 ResourceMark rm; | |
717 | |
718 // create the thread instance name space string - don't create an | |
719 // instance subspace if instance is -1 - keeps the adapterThread | |
720 // counters from having a ".0" namespace. | |
721 const char* thread_i = (instance == -1) ? thread_name : | |
722 PerfDataManager::name_space(thread_name, instance); | |
723 | |
724 | |
725 char* name = PerfDataManager::counter_name(thread_i, "method"); | |
726 _perf_current_method = | |
727 PerfDataManager::create_string_variable(SUN_CI, name, | |
728 cmname_buffer_length, | |
729 _current_method, CHECK); | |
730 | |
731 name = PerfDataManager::counter_name(thread_i, "type"); | |
732 _perf_compile_type = PerfDataManager::create_variable(SUN_CI, name, | |
733 PerfData::U_None, | |
734 (jlong)_compile_type, | |
735 CHECK); | |
736 | |
737 name = PerfDataManager::counter_name(thread_i, "time"); | |
738 _perf_time = PerfDataManager::create_counter(SUN_CI, name, | |
739 PerfData::U_Ticks, CHECK); | |
740 | |
741 name = PerfDataManager::counter_name(thread_i, "compiles"); | |
742 _perf_compiles = PerfDataManager::create_counter(SUN_CI, name, | |
743 PerfData::U_Events, CHECK); | |
744 } | |
745 } | |
746 | |
747 // ------------------------------------------------------------------ | |
748 // CompileBroker::compilation_init | |
749 // | |
750 // Initialize the Compilation object | |
751 void CompileBroker::compilation_init() { | |
752 _last_method_compiled[0] = '\0'; | |
753 | |
13016
a196f1aaec86
8026949: -Xint flag prints wrong warning: Initialization of C1 thread failed (no space to run compilers)
anoll
parents:
12965
diff
changeset
|
754 // No need to initialize compilation system if we do not use it. |
a196f1aaec86
8026949: -Xint flag prints wrong warning: Initialization of C1 thread failed (no space to run compilers)
anoll
parents:
12965
diff
changeset
|
755 if (!UseCompiler) { |
a196f1aaec86
8026949: -Xint flag prints wrong warning: Initialization of C1 thread failed (no space to run compilers)
anoll
parents:
12965
diff
changeset
|
756 return; |
a196f1aaec86
8026949: -Xint flag prints wrong warning: Initialization of C1 thread failed (no space to run compilers)
anoll
parents:
12965
diff
changeset
|
757 } |
1970 | 758 #ifndef SHARK |
0 | 759 // Set the interface to the current compiler(s). |
1783 | 760 int c1_count = CompilationPolicy::policy()->compiler_count(CompLevel_simple); |
761 int c2_count = CompilationPolicy::policy()->compiler_count(CompLevel_full_optimization); | |
7154
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
762 #ifdef GRAAL |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
763 GraalCompiler* graal = new GraalCompiler(); |
5d0bb7d52783
changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents:
7125
diff
changeset
|
764 #endif |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
765 |
0 | 766 #ifdef COMPILER1 |
1783 | 767 if (c1_count > 0) { |
768 _compilers[0] = new Compiler(); | |
769 } | |
0 | 770 #endif // COMPILER1 |
771 | |
14124
7ad529321294
make: remove GRAALVM and introduce COMPILERGRAAL. fix client hosted-mode
Bernhard Urban <bernhard.urban@jku.at>
parents:
14107
diff
changeset
|
772 #if defined(COMPILERGRAAL) |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
773 _compilers[1] = graal; |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
774 c2_count = 0; |
14124
7ad529321294
make: remove GRAALVM and introduce COMPILERGRAAL. fix client hosted-mode
Bernhard Urban <bernhard.urban@jku.at>
parents:
14107
diff
changeset
|
775 #endif // COMPILERGRAAL |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
776 |
0 | 777 #ifdef COMPILER2 |
1783 | 778 if (c2_count > 0) { |
779 _compilers[1] = new C2Compiler(); | |
780 } | |
0 | 781 #endif // COMPILER2 |
1970 | 782 #else // SHARK |
783 int c1_count = 0; | |
784 int c2_count = 1; | |
785 | |
786 _compilers[1] = new SharkCompiler(); | |
787 #endif // SHARK | |
1692 | 788 |
0 | 789 // Initialize the CompileTask free list |
790 _task_free_list = NULL; | |
791 | |
792 // Start the CompilerThreads | |
1783 | 793 init_compiler_threads(c1_count, c2_count); |
0 | 794 // totalTime performance counter is always created as it is required |
795 // by the implementation of java.lang.management.CompilationMBean. | |
796 { | |
797 EXCEPTION_MARK; | |
798 _perf_total_compilation = | |
799 PerfDataManager::create_counter(JAVA_CI, "totalTime", | |
800 PerfData::U_Ticks, CHECK); | |
801 } | |
802 | |
803 | |
804 if (UsePerfData) { | |
805 | |
806 EXCEPTION_MARK; | |
807 | |
808 // create the jvmstat performance counters | |
809 _perf_osr_compilation = | |
810 PerfDataManager::create_counter(SUN_CI, "osrTime", | |
811 PerfData::U_Ticks, CHECK); | |
812 | |
813 _perf_standard_compilation = | |
814 PerfDataManager::create_counter(SUN_CI, "standardTime", | |
815 PerfData::U_Ticks, CHECK); | |
816 | |
817 _perf_total_bailout_count = | |
818 PerfDataManager::create_counter(SUN_CI, "totalBailouts", | |
819 PerfData::U_Events, CHECK); | |
820 | |
821 _perf_total_invalidated_count = | |
822 PerfDataManager::create_counter(SUN_CI, "totalInvalidates", | |
823 PerfData::U_Events, CHECK); | |
824 | |
825 _perf_total_compile_count = | |
826 PerfDataManager::create_counter(SUN_CI, "totalCompiles", | |
827 PerfData::U_Events, CHECK); | |
828 _perf_total_osr_compile_count = | |
829 PerfDataManager::create_counter(SUN_CI, "osrCompiles", | |
830 PerfData::U_Events, CHECK); | |
831 | |
832 _perf_total_standard_compile_count = | |
833 PerfDataManager::create_counter(SUN_CI, "standardCompiles", | |
834 PerfData::U_Events, CHECK); | |
835 | |
836 _perf_sum_osr_bytes_compiled = | |
837 PerfDataManager::create_counter(SUN_CI, "osrBytes", | |
838 PerfData::U_Bytes, CHECK); | |
839 | |
840 _perf_sum_standard_bytes_compiled = | |
841 PerfDataManager::create_counter(SUN_CI, "standardBytes", | |
842 PerfData::U_Bytes, CHECK); | |
843 | |
844 _perf_sum_nmethod_size = | |
845 PerfDataManager::create_counter(SUN_CI, "nmethodSize", | |
846 PerfData::U_Bytes, CHECK); | |
847 | |
848 _perf_sum_nmethod_code_size = | |
849 PerfDataManager::create_counter(SUN_CI, "nmethodCodeSize", | |
850 PerfData::U_Bytes, CHECK); | |
851 | |
852 _perf_last_method = | |
853 PerfDataManager::create_string_variable(SUN_CI, "lastMethod", | |
854 CompilerCounters::cmname_buffer_length, | |
855 "", CHECK); | |
856 | |
857 _perf_last_failed_method = | |
858 PerfDataManager::create_string_variable(SUN_CI, "lastFailedMethod", | |
859 CompilerCounters::cmname_buffer_length, | |
860 "", CHECK); | |
861 | |
862 _perf_last_invalidated_method = | |
863 PerfDataManager::create_string_variable(SUN_CI, "lastInvalidatedMethod", | |
864 CompilerCounters::cmname_buffer_length, | |
865 "", CHECK); | |
866 | |
867 _perf_last_compile_type = | |
868 PerfDataManager::create_variable(SUN_CI, "lastType", | |
869 PerfData::U_None, | |
870 (jlong)CompileBroker::no_compile, | |
871 CHECK); | |
872 | |
873 _perf_last_compile_size = | |
874 PerfDataManager::create_variable(SUN_CI, "lastSize", | |
875 PerfData::U_Bytes, | |
876 (jlong)CompileBroker::no_compile, | |
877 CHECK); | |
878 | |
879 | |
880 _perf_last_failed_type = | |
881 PerfDataManager::create_variable(SUN_CI, "lastFailedType", | |
882 PerfData::U_None, | |
883 (jlong)CompileBroker::no_compile, | |
884 CHECK); | |
885 | |
886 _perf_last_invalidated_type = | |
887 PerfDataManager::create_variable(SUN_CI, "lastInvalidatedType", | |
888 PerfData::U_None, | |
889 (jlong)CompileBroker::no_compile, | |
890 CHECK); | |
891 } | |
892 | |
893 _initialized = true; | |
894 } | |
895 | |
896 | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
897 CompilerThread* CompileBroker::make_compiler_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
898 AbstractCompiler* comp, TRAPS) { |
0 | 899 CompilerThread* compiler_thread = NULL; |
900 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
901 Klass* k = |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
902 SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), |
0 | 903 true, CHECK_0); |
904 instanceKlassHandle klass (THREAD, k); | |
905 instanceHandle thread_oop = klass->allocate_instance_handle(CHECK_0); | |
906 Handle string = java_lang_String::create_from_str(name, CHECK_0); | |
907 | |
908 // Initialize thread_oop to put it into the system threadGroup | |
909 Handle thread_group (THREAD, Universe::system_thread_group()); | |
910 JavaValue result(T_VOID); | |
911 JavaCalls::call_special(&result, thread_oop, | |
912 klass, | |
2177
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
913 vmSymbols::object_initializer_name(), |
3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
1972
diff
changeset
|
914 vmSymbols::threadgroup_string_void_signature(), |
0 | 915 thread_group, |
916 string, | |
917 CHECK_0); | |
918 | |
919 { | |
920 MutexLocker mu(Threads_lock, THREAD); | |
921 compiler_thread = new CompilerThread(queue, counters); | |
922 // At this point the new CompilerThread data-races with this startup | |
923 // thread (which I believe is the primoridal thread and NOT the VM | |
924 // thread). This means Java bytecodes being executed at startup can | |
925 // queue compile jobs which will run at whatever default priority the | |
926 // newly created CompilerThread runs at. | |
927 | |
928 | |
929 // At this point it may be possible that no osthread was created for the | |
930 // JavaThread due to lack of memory. We would have to throw an exception | |
931 // in that case. However, since this must work and we do not allow | |
932 // exceptions anyway, check and abort if this fails. | |
933 | |
934 if (compiler_thread == NULL || compiler_thread->osthread() == NULL){ | |
935 vm_exit_during_initialization("java.lang.OutOfMemoryError", | |
14341
ad3f8397fe37
7182040: volano29 limited by os resource on Linux - need better diagnostic message
iklam
parents:
14278
diff
changeset
|
936 os::native_thread_creation_failed_msg()); |
0 | 937 } |
938 | |
939 java_lang_Thread::set_thread(thread_oop(), compiler_thread); | |
940 | |
941 // Note that this only sets the JavaThread _priority field, which by | |
942 // definition is limited to Java priorities and not OS priorities. | |
943 // The os-priority is set in the CompilerThread startup code itself | |
4854
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
944 |
0 | 945 java_lang_Thread::set_priority(thread_oop(), NearMaxPriority); |
4854
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
946 |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
947 // Note that we cannot call os::set_priority because it expects Java |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
948 // priorities and we are *explicitly* using OS priorities so that it's |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
949 // possible to set the compiler thread priority higher than any Java |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
950 // thread. |
0 | 951 |
4854
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
952 int native_prio = CompilerThreadPriority; |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
953 if (native_prio == -1) { |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
954 if (UseCriticalCompilerThreadPriority) { |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
955 native_prio = os::java_to_os_priority[CriticalPriority]; |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
956 } else { |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
957 native_prio = os::java_to_os_priority[NearMaxPriority]; |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
958 } |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
959 } |
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
960 os::set_native_priority(compiler_thread, native_prio); |
0 | 961 |
962 java_lang_Thread::set_daemon(thread_oop()); | |
963 | |
964 compiler_thread->set_threadObj(thread_oop()); | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
965 compiler_thread->set_compiler(comp); |
0 | 966 Threads::add(compiler_thread); |
967 Thread::start(compiler_thread); | |
968 } | |
4854
de268c8a8075
7082553: Interpret Thread.setPriority(Thread.MAX_PRIORITY) to mean FX60 on Solaris 10 and 11
phh
parents:
4122
diff
changeset
|
969 |
0 | 970 // Let go of Threads_lock before yielding |
971 os::yield(); // make sure that the compiler thread is started early (especially helpful on SOLARIS) | |
972 | |
973 return compiler_thread; | |
974 } | |
975 | |
976 | |
1783 | 977 void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) { |
0 | 978 EXCEPTION_MARK; |
14124
7ad529321294
make: remove GRAALVM and introduce COMPILERGRAAL. fix client hosted-mode
Bernhard Urban <bernhard.urban@jku.at>
parents:
14107
diff
changeset
|
979 #if !defined(ZERO) && !defined(SHARK) && !defined(COMPILERGRAAL) |
1783 | 980 assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?"); |
14124
7ad529321294
make: remove GRAALVM and introduce COMPILERGRAAL. fix client hosted-mode
Bernhard Urban <bernhard.urban@jku.at>
parents:
14107
diff
changeset
|
981 #endif // !ZERO && !SHARK && !COMPILERGRAAL |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
982 // Initialize the compilation queue |
1783 | 983 if (c2_compiler_count > 0) { |
984 _c2_method_queue = new CompileQueue("C2MethodQueue", MethodCompileQueue_lock); | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
985 _compilers[1]->set_num_compiler_threads(c2_compiler_count); |
1783 | 986 } |
987 if (c1_compiler_count > 0) { | |
988 _c1_method_queue = new CompileQueue("C1MethodQueue", MethodCompileQueue_lock); | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
989 _compilers[0]->set_num_compiler_threads(c1_compiler_count); |
1783 | 990 } |
0 | 991 |
1783 | 992 int compiler_count = c1_compiler_count + c2_compiler_count; |
993 | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
994 _compiler_threads = |
6197 | 995 new (ResourceObj::C_HEAP, mtCompiler) GrowableArray<CompilerThread*>(compiler_count, true); |
0 | 996 |
997 char name_buffer[256]; | |
1783 | 998 for (int i = 0; i < c2_compiler_count; i++) { |
0 | 999 // Create a name for our thread. |
1783 | 1000 sprintf(name_buffer, "C2 CompilerThread%d", i); |
0 | 1001 CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK); |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1002 // Shark and C2 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1003 CompilerThread* new_thread = make_compiler_thread(name_buffer, _c2_method_queue, counters, _compilers[1], CHECK); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1004 _compiler_threads->append(new_thread); |
0 | 1005 } |
1783 | 1006 |
1007 for (int i = c2_compiler_count; i < compiler_count; i++) { | |
1008 // Create a name for our thread. | |
1009 sprintf(name_buffer, "C1 CompilerThread%d", i); | |
1010 CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK); | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1011 // C1 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1012 CompilerThread* new_thread = make_compiler_thread(name_buffer, _c1_method_queue, counters, _compilers[0], CHECK); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1013 _compiler_threads->append(new_thread); |
1783 | 1014 } |
1015 | |
0 | 1016 if (UsePerfData) { |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1017 PerfDataManager::create_constant(SUN_CI, "threads", PerfData::U_Bytes, compiler_count, CHECK); |
0 | 1018 } |
1019 } | |
1020 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1021 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1022 // Set the methods on the stack as on_stack so that redefine classes doesn't |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1023 // reclaim them |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1024 void CompileBroker::mark_on_stack() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1025 if (_c2_method_queue != NULL) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1026 _c2_method_queue->mark_on_stack(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1027 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1028 if (_c1_method_queue != NULL) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1029 _c1_method_queue->mark_on_stack(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1030 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1031 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1032 |
0 | 1033 // ------------------------------------------------------------------ |
1034 // CompileBroker::compile_method | |
1035 // | |
1036 // Request compilation of a method. | |
1037 void CompileBroker::compile_method_base(methodHandle method, | |
1038 int osr_bci, | |
1039 int comp_level, | |
1040 methodHandle hot_method, | |
1041 int hot_count, | |
1042 const char* comment, | |
4825
20334ed5ed3c
7131259: compile_method and CompilationPolicy::event shouldn't be declared TRAPS
iveresov
parents:
4122
diff
changeset
|
1043 Thread* thread) { |
0 | 1044 // do nothing if compiler thread(s) is not available |
1045 if (!_initialized ) { | |
1046 return; | |
1047 } | |
1048 | |
1049 guarantee(!method->is_abstract(), "cannot compile abstract methods"); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1050 assert(method->method_holder()->oop_is_instance(), |
0 | 1051 "sanity check"); |
6940
18fb7da42534
8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents:
6843
diff
changeset
|
1052 assert(!method->method_holder()->is_not_initialized(), |
0 | 1053 "method holder must be initialized"); |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
1054 assert(!method->is_method_handle_intrinsic(), "do not enqueue these guys"); |
0 | 1055 |
1056 if (CIPrintRequests) { | |
1057 tty->print("request: "); | |
1058 method->print_short_name(tty); | |
1059 if (osr_bci != InvocationEntryBci) { | |
1060 tty->print(" osr_bci: %d", osr_bci); | |
1061 } | |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1062 tty->print(" level: %d comment: %s count: %d", comp_level, comment, hot_count); |
0 | 1063 if (!hot_method.is_null()) { |
1064 tty->print(" hot: "); | |
1065 if (hot_method() != method()) { | |
1066 hot_method->print_short_name(tty); | |
1067 } else { | |
1068 tty->print("yes"); | |
1069 } | |
1070 } | |
1071 tty->cr(); | |
1072 } | |
1073 | |
1074 // A request has been made for compilation. Before we do any | |
1075 // real work, check to see if the method has been compiled | |
1076 // in the meantime with a definitive result. | |
1077 if (compilation_is_complete(method, osr_bci, comp_level)) { | |
1078 return; | |
1079 } | |
1080 | |
2403 | 1081 #ifndef PRODUCT |
1082 if (osr_bci != -1 && !FLAG_IS_DEFAULT(OSROnlyBCI)) { | |
1083 if ((OSROnlyBCI > 0) ? (OSROnlyBCI != osr_bci) : (-OSROnlyBCI == osr_bci)) { | |
1084 // Positive OSROnlyBCI means only compile that bci. Negative means don't compile that BCI. | |
1085 return; | |
1086 } | |
1087 } | |
1088 #endif | |
1783 | 1089 |
0 | 1090 // If this method is already in the compile queue, then |
1091 // we do not block the current thread. | |
1092 if (compilation_is_in_queue(method, osr_bci)) { | |
1093 // We may want to decay our counter a bit here to prevent | |
1094 // multiple denied requests for compilation. This is an | |
1095 // open compilation policy issue. Note: The other possibility, | |
1096 // in the case that this is a blocking compile request, is to have | |
1097 // all subsequent blocking requesters wait for completion of | |
1098 // ongoing compiles. Note that in this case we'll need a protocol | |
1099 // for freeing the associated compile tasks. [Or we could have | |
1100 // a single static monitor on which all these waiters sleep.] | |
1101 return; | |
1102 } | |
1103 | |
3294
86ebb26bcdeb
7037756: Deadlock in compiler thread similiar to 6789220
johnc
parents:
2482
diff
changeset
|
1104 // If the requesting thread is holding the pending list lock |
86ebb26bcdeb
7037756: Deadlock in compiler thread similiar to 6789220
johnc
parents:
2482
diff
changeset
|
1105 // then we just return. We can't risk blocking while holding |
86ebb26bcdeb
7037756: Deadlock in compiler thread similiar to 6789220
johnc
parents:
2482
diff
changeset
|
1106 // the pending list lock or a 3-way deadlock may occur |
86ebb26bcdeb
7037756: Deadlock in compiler thread similiar to 6789220
johnc
parents:
2482
diff
changeset
|
1107 // between the reference handler thread, a GC (instigated |
86ebb26bcdeb
7037756: Deadlock in compiler thread similiar to 6789220
johnc
parents:
2482
diff
changeset
|
1108 // by a compiler thread), and compiled method registration. |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
1109 if (InstanceRefKlass::owns_pending_list_lock(JavaThread::current())) { |
3294
86ebb26bcdeb
7037756: Deadlock in compiler thread similiar to 6789220
johnc
parents:
2482
diff
changeset
|
1110 return; |
86ebb26bcdeb
7037756: Deadlock in compiler thread similiar to 6789220
johnc
parents:
2482
diff
changeset
|
1111 } |
86ebb26bcdeb
7037756: Deadlock in compiler thread similiar to 6789220
johnc
parents:
2482
diff
changeset
|
1112 |
14124
7ad529321294
make: remove GRAALVM and introduce COMPILERGRAAL. fix client hosted-mode
Bernhard Urban <bernhard.urban@jku.at>
parents:
14107
diff
changeset
|
1113 #if defined(COMPILERGRAAL) |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1114 // In tiered mode we want to only handle highest tier compiles and |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1115 // in non-tiered mode the default level should be |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1116 // CompLevel_full_optimization which equals CompLevel_highest_tier. |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1117 assert(TieredCompilation || comp_level == CompLevel_full_optimization, "incorrect compile level"); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1118 assert(CompLevel_full_optimization == CompLevel_highest_tier, "incorrect level definition"); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1119 if (comp_level == CompLevel_full_optimization) { |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1120 if (!JavaThread::current()->is_graal_compiling()) { |
14524
10c4df6767c4
removed GPU offload interaction with compilation policy
Doug Simon <doug.simon@oracle.com>
parents:
14518
diff
changeset
|
1121 bool blockingCompilation = is_compile_blocking(method, osr_bci); |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1122 GraalCompiler::instance()->compile_method(method, osr_bci, blockingCompilation); |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1123 } else { |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1124 // Can't enqueue this request because there would be no one to service it, so simply return. |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1125 } |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1126 return; |
13089
77fbf02f701c
re-enabled protection against recursive Graal compilation requests with Graal specific _graal_compiling field in JavaThread
Doug Simon <doug.simon@oracle.com>
parents:
13086
diff
changeset
|
1127 } |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
1128 assert(TieredCompilation, "should only reach here in tiered mode"); |
14124
7ad529321294
make: remove GRAALVM and introduce COMPILERGRAAL. fix client hosted-mode
Bernhard Urban <bernhard.urban@jku.at>
parents:
14107
diff
changeset
|
1129 #endif // COMPILERGRAAL |
3294
86ebb26bcdeb
7037756: Deadlock in compiler thread similiar to 6789220
johnc
parents:
2482
diff
changeset
|
1130 |
0 | 1131 // Outputs from the following MutexLocker block: |
1132 CompileTask* task = NULL; | |
1133 bool blocking = false; | |
1783 | 1134 CompileQueue* queue = compile_queue(comp_level); |
0 | 1135 |
1136 // Acquire our lock. | |
1137 { | |
4825
20334ed5ed3c
7131259: compile_method and CompilationPolicy::event shouldn't be declared TRAPS
iveresov
parents:
4122
diff
changeset
|
1138 MutexLocker locker(queue->lock(), thread); |
0 | 1139 |
1140 // Make sure the method has not slipped into the queues since | |
1141 // last we checked; note that those checks were "fast bail-outs". | |
1142 // Here we need to be more careful, see 14012000 below. | |
1143 if (compilation_is_in_queue(method, osr_bci)) { | |
1144 return; | |
1145 } | |
1146 | |
1147 // We need to check again to see if the compilation has | |
1148 // completed. A previous compilation may have registered | |
1149 // some result. | |
1150 if (compilation_is_complete(method, osr_bci, comp_level)) { | |
1151 return; | |
1152 } | |
1153 | |
1154 // We now know that this compilation is not pending, complete, | |
1155 // or prohibited. Assign a compile_id to this compilation | |
1156 // and check to see if it is in our [Start..Stop) range. | |
14236 | 1157 int compile_id = assign_compile_id(method, osr_bci); |
0 | 1158 if (compile_id == 0) { |
1159 // The compilation falls outside the allowed range. | |
1160 return; | |
1161 } | |
1162 | |
1163 // Should this thread wait for completion of the compile? | |
1164 blocking = is_compile_blocking(method, osr_bci); | |
1165 | |
1166 // We will enter the compilation in the queue. | |
1167 // 14012000: Note that this sets the queued_for_compile bits in | |
1168 // the target method. We can now reason that a method cannot be | |
1169 // queued for compilation more than once, as follows: | |
1170 // Before a thread queues a task for compilation, it first acquires | |
1171 // the compile queue lock, then checks if the method's queued bits | |
1172 // are set or it has already been compiled. Thus there can not be two | |
1173 // instances of a compilation task for the same method on the | |
1174 // compilation queue. Consider now the case where the compilation | |
1175 // thread has already removed a task for that method from the queue | |
1176 // and is in the midst of compiling it. In this case, the | |
1177 // queued_for_compile bits must be set in the method (and these | |
1178 // will be visible to the current thread, since the bits were set | |
1179 // under protection of the compile queue lock, which we hold now. | |
1180 // When the compilation completes, the compiler thread first sets | |
1181 // the compilation result and then clears the queued_for_compile | |
1182 // bits. Neither of these actions are protected by a barrier (or done | |
1183 // under the protection of a lock), so the only guarantee we have | |
1184 // (on machines with TSO (Total Store Order)) is that these values | |
1185 // will update in that order. As a result, the only combinations of | |
1186 // these bits that the current thread will see are, in temporal order: | |
1187 // <RESULT, QUEUE> : | |
1188 // <0, 1> : in compile queue, but not yet compiled | |
1189 // <1, 1> : compiled but queue bit not cleared | |
1190 // <1, 0> : compiled and queue bit cleared | |
1191 // Because we first check the queue bits then check the result bits, | |
1192 // we are assured that we cannot introduce a duplicate task. | |
1193 // Note that if we did the tests in the reverse order (i.e. check | |
1194 // result then check queued bit), we could get the result bit before | |
1195 // the compilation completed, and the queue bit after the compilation | |
1196 // completed, and end up introducing a "duplicate" (redundant) task. | |
1197 // In that case, the compiler thread should first check if a method | |
1198 // has already been compiled before trying to compile it. | |
1199 // NOTE: in the event that there are multiple compiler threads and | |
1200 // there is de-optimization/recompilation, things will get hairy, | |
1201 // and in that case it's best to protect both the testing (here) of | |
1202 // these bits, and their updating (here and elsewhere) under a | |
1203 // common lock. | |
1783 | 1204 task = create_compile_task(queue, |
0 | 1205 compile_id, method, |
1206 osr_bci, comp_level, | |
1207 hot_method, hot_count, comment, | |
1208 blocking); | |
1209 } | |
1210 | |
1211 if (blocking) { | |
1212 wait_for_completion(task); | |
1213 } | |
1214 } | |
1215 | |
1216 | |
1217 nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci, | |
1783 | 1218 int comp_level, |
0 | 1219 methodHandle hot_method, int hot_count, |
4825
20334ed5ed3c
7131259: compile_method and CompilationPolicy::event shouldn't be declared TRAPS
iveresov
parents:
4122
diff
changeset
|
1220 const char* comment, Thread* THREAD) { |
0 | 1221 // make sure arguments make sense |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1222 assert(method->method_holder()->oop_is_instance(), "not an instance method"); |
0 | 1223 assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); |
1224 assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); | |
9026
22851e342f0e
Make calling the installed code from compiled code possible.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
8883
diff
changeset
|
1225 assert(!method->method_holder()->is_not_initialized() || method->intrinsic_id() == vmIntrinsics::_CompilerToVMImpl_executeCompiledMethod, "method holder must be initialized"); |
9080
b84fd7d73702
8007288: Additional WB API for compiler's testing
iignatyev
parents:
8860
diff
changeset
|
1226 // allow any levels for WhiteBox |
b84fd7d73702
8007288: Additional WB API for compiler's testing
iignatyev
parents:
8860
diff
changeset
|
1227 assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered"); |
0 | 1228 // return quickly if possible |
1229 | |
1230 // lock, make sure that the compilation | |
1231 // isn't prohibited in a straightforward way. | |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1232 AbstractCompiler *comp = CompileBroker::compiler(comp_level); |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1233 if (comp == NULL || !comp->can_compile_method(method) || |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1234 compilation_is_prohibited(method, osr_bci, comp_level)) { |
0 | 1235 return NULL; |
1236 } | |
1237 | |
1238 if (osr_bci == InvocationEntryBci) { | |
1239 // standard compilation | |
1240 nmethod* method_code = method->code(); | |
1783 | 1241 if (method_code != NULL) { |
1242 if (compilation_is_complete(method, osr_bci, comp_level)) { | |
1243 return method_code; | |
1244 } | |
0 | 1245 } |
12324
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
1246 if (method->is_not_compilable(comp_level)) { |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
1247 return NULL; |
1202 | 1248 } |
0 | 1249 } else { |
1250 // osr compilation | |
1251 #ifndef TIERED | |
1252 // seems like an assert of dubious value | |
1783 | 1253 assert(comp_level == CompLevel_highest_tier, |
0 | 1254 "all OSR compiles are assumed to be at a single compilation lavel"); |
1255 #endif // TIERED | |
1783 | 1256 // We accept a higher level osr method |
1257 nmethod* nm = method->lookup_osr_nmethod_for(osr_bci, comp_level, false); | |
0 | 1258 if (nm != NULL) return nm; |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
1259 if (method->is_not_osr_compilable(comp_level)) return NULL; |
0 | 1260 } |
1261 | |
1262 assert(!HAS_PENDING_EXCEPTION, "No exception should be present"); | |
1263 // some prerequisites that are compiler specific | |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1264 if (comp->is_c2() || comp->is_shark()) { |
4825
20334ed5ed3c
7131259: compile_method and CompilationPolicy::event shouldn't be declared TRAPS
iveresov
parents:
4122
diff
changeset
|
1265 method->constants()->resolve_string_constants(CHECK_AND_CLEAR_NULL); |
0 | 1266 // Resolve all classes seen in the signature of the method |
1267 // we are compiling. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1268 Method::load_signature_classes(method, CHECK_AND_CLEAR_NULL); |
0 | 1269 } |
1270 | |
1271 // If the method is native, do the lookup in the thread requesting | |
1272 // the compilation. Native lookups can load code, which is not | |
1273 // permitted during compilation. | |
1274 // | |
1275 // Note: A native method implies non-osr compilation which is | |
1276 // checked with an assertion at the entry of this method. | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
1277 if (method->is_native() && !method->is_method_handle_intrinsic()) { |
0 | 1278 bool in_base_library; |
1279 address adr = NativeLookup::lookup(method, in_base_library, THREAD); | |
1280 if (HAS_PENDING_EXCEPTION) { | |
1281 // In case of an exception looking up the method, we just forget | |
1282 // about it. The interpreter will kick-in and throw the exception. | |
1283 method->set_not_compilable(); // implies is_not_osr_compilable() | |
1284 CLEAR_PENDING_EXCEPTION; | |
1285 return NULL; | |
1286 } | |
1287 assert(method->has_native_function(), "must have native code by now"); | |
1288 } | |
1289 | |
1290 // RedefineClasses() has replaced this method; just return | |
1291 if (method->is_old()) { | |
1292 return NULL; | |
1293 } | |
1294 | |
1295 // JVMTI -- post_compile_event requires jmethod_id() that may require | |
1296 // a lock the compiling thread can not acquire. Prefetch it here. | |
1297 if (JvmtiExport::should_post_compiled_method_load()) { | |
1298 method->jmethod_id(); | |
1299 } | |
1300 | |
1301 // do the compilation | |
1302 if (method->is_native()) { | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
6197
diff
changeset
|
1303 if (!PreferInterpreterNativeStubs || method->is_method_handle_intrinsic()) { |
12965
8b4bbba322d3
8026407: VM crashes on linux-ppc and linux-i586 when there is not enough ReservedCodeCacheSize specified
anoll
parents:
12880
diff
changeset
|
1304 // To properly handle the appendix argument for out-of-line calls we are using a small trampoline that |
8b4bbba322d3
8026407: VM crashes on linux-ppc and linux-i586 when there is not enough ReservedCodeCacheSize specified
anoll
parents:
12880
diff
changeset
|
1305 // pops off the appendix argument and jumps to the target (see gen_special_dispatch in SharedRuntime). |
8b4bbba322d3
8026407: VM crashes on linux-ppc and linux-i586 when there is not enough ReservedCodeCacheSize specified
anoll
parents:
12880
diff
changeset
|
1306 // |
8b4bbba322d3
8026407: VM crashes on linux-ppc and linux-i586 when there is not enough ReservedCodeCacheSize specified
anoll
parents:
12880
diff
changeset
|
1307 // Since normal compiled-to-compiled calls are not able to handle such a thing we MUST generate an adapter |
8b4bbba322d3
8026407: VM crashes on linux-ppc and linux-i586 when there is not enough ReservedCodeCacheSize specified
anoll
parents:
12880
diff
changeset
|
1308 // in this case. If we can't generate one and use it we can not execute the out-of-line method handle calls. |
14236 | 1309 AdapterHandlerLibrary::create_native_wrapper(method); |
0 | 1310 } else { |
1311 return NULL; | |
1312 } | |
1313 } else { | |
12965
8b4bbba322d3
8026407: VM crashes on linux-ppc and linux-i586 when there is not enough ReservedCodeCacheSize specified
anoll
parents:
12880
diff
changeset
|
1314 // If the compiler is shut off due to code cache getting full |
8b4bbba322d3
8026407: VM crashes on linux-ppc and linux-i586 when there is not enough ReservedCodeCacheSize specified
anoll
parents:
12880
diff
changeset
|
1315 // fail out now so blocking compiles dont hang the java thread |
8b4bbba322d3
8026407: VM crashes on linux-ppc and linux-i586 when there is not enough ReservedCodeCacheSize specified
anoll
parents:
12880
diff
changeset
|
1316 if (!should_compile_new_jobs()) { |
8b4bbba322d3
8026407: VM crashes on linux-ppc and linux-i586 when there is not enough ReservedCodeCacheSize specified
anoll
parents:
12880
diff
changeset
|
1317 CompilationPolicy::policy()->delay_compilation(method()); |
8b4bbba322d3
8026407: VM crashes on linux-ppc and linux-i586 when there is not enough ReservedCodeCacheSize specified
anoll
parents:
12880
diff
changeset
|
1318 return NULL; |
8b4bbba322d3
8026407: VM crashes on linux-ppc and linux-i586 when there is not enough ReservedCodeCacheSize specified
anoll
parents:
12880
diff
changeset
|
1319 } |
4825
20334ed5ed3c
7131259: compile_method and CompilationPolicy::event shouldn't be declared TRAPS
iveresov
parents:
4122
diff
changeset
|
1320 compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, THREAD); |
0 | 1321 } |
1322 | |
1323 // return requested nmethod | |
1783 | 1324 // We accept a higher level osr method |
1325 return osr_bci == InvocationEntryBci ? method->code() : method->lookup_osr_nmethod_for(osr_bci, comp_level, false); | |
0 | 1326 } |
1327 | |
1328 | |
1329 // ------------------------------------------------------------------ | |
1330 // CompileBroker::compilation_is_complete | |
1331 // | |
1332 // See if compilation of this method is already complete. | |
1333 bool CompileBroker::compilation_is_complete(methodHandle method, | |
1334 int osr_bci, | |
1335 int comp_level) { | |
1336 bool is_osr = (osr_bci != standard_entry_bci); | |
1337 if (is_osr) { | |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
1338 if (method->is_not_osr_compilable(comp_level)) { |
0 | 1339 return true; |
1340 } else { | |
1783 | 1341 nmethod* result = method->lookup_osr_nmethod_for(osr_bci, comp_level, true); |
0 | 1342 return (result != NULL); |
1343 } | |
1344 } else { | |
1345 if (method->is_not_compilable(comp_level)) { | |
1346 return true; | |
1347 } else { | |
1348 nmethod* result = method->code(); | |
1349 if (result == NULL) return false; | |
1783 | 1350 return comp_level == result->comp_level(); |
0 | 1351 } |
1352 } | |
1353 } | |
1354 | |
1355 | |
1356 // ------------------------------------------------------------------ | |
1357 // CompileBroker::compilation_is_in_queue | |
1358 // | |
1359 // See if this compilation is already requested. | |
1360 // | |
1361 // Implementation note: there is only a single "is in queue" bit | |
1362 // for each method. This means that the check below is overly | |
1363 // conservative in the sense that an osr compilation in the queue | |
1364 // will block a normal compilation from entering the queue (and vice | |
1365 // versa). This can be remedied by a full queue search to disambiguate | |
1366 // cases. If it is deemed profitible, this may be done. | |
1367 bool CompileBroker::compilation_is_in_queue(methodHandle method, | |
1783 | 1368 int osr_bci) { |
0 | 1369 return method->queued_for_compilation(); |
1370 } | |
1371 | |
1372 // ------------------------------------------------------------------ | |
1373 // CompileBroker::compilation_is_prohibited | |
1374 // | |
1375 // See if this compilation is not allowed. | |
1376 bool CompileBroker::compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level) { | |
1377 bool is_native = method->is_native(); | |
1378 // Some compilers may not support the compilation of natives. | |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1379 AbstractCompiler *comp = compiler(comp_level); |
0 | 1380 if (is_native && |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1381 (!CICompileNatives || comp == NULL || !comp->supports_native())) { |
1783 | 1382 method->set_not_compilable_quietly(comp_level); |
0 | 1383 return true; |
1384 } | |
1385 | |
1386 bool is_osr = (osr_bci != standard_entry_bci); | |
1387 // Some compilers may not support on stack replacement. | |
1388 if (is_osr && | |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1389 (!CICompileOSR || comp == NULL || !comp->supports_osr())) { |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
1390 method->set_not_osr_compilable(comp_level); |
0 | 1391 return true; |
1392 } | |
1393 | |
1394 // The method may be explicitly excluded by the user. | |
1395 bool quietly; | |
1396 if (CompilerOracle::should_exclude(method, quietly)) { | |
1397 if (!quietly) { | |
1398 // This does not happen quietly... | |
1399 ResourceMark rm; | |
1400 tty->print("### Excluding %s:%s", | |
1401 method->is_native() ? "generation of native wrapper" : "compile", | |
1402 (method->is_static() ? " static" : "")); | |
1403 method->print_short_name(tty); | |
1404 tty->cr(); | |
1405 } | |
7998 | 1406 method->set_not_compilable(CompLevel_all, !quietly, "excluded by CompilerOracle"); |
0 | 1407 } |
1408 | |
1409 return false; | |
1410 } | |
1411 | |
14236 | 1412 /** |
1413 * Generate serialized IDs for compilation requests. If certain debugging flags are used | |
1414 * and the ID is not within the specified range, the method is not compiled and 0 is returned. | |
1415 * The function also allows to generate separate compilation IDs for OSR compilations. | |
1416 */ | |
1417 int CompileBroker::assign_compile_id(methodHandle method, int osr_bci) { | |
1418 #ifdef ASSERT | |
0 | 1419 bool is_osr = (osr_bci != standard_entry_bci); |
14236 | 1420 int id; |
1421 if (method->is_native()) { | |
1422 assert(!is_osr, "can't be osr"); | |
1423 // Adapters, native wrappers and method handle intrinsics | |
1424 // should be generated always. | |
1425 return Atomic::add(1, &_compilation_id); | |
1426 } else if (CICountOSR && is_osr) { | |
1427 id = Atomic::add(1, &_osr_compilation_id); | |
1428 if (CIStartOSR <= id && id < CIStopOSR) { | |
0 | 1429 return id; |
1430 } | |
1431 } else { | |
14236 | 1432 id = Atomic::add(1, &_compilation_id); |
1433 if (CIStart <= id && id < CIStop) { | |
0 | 1434 return id; |
1435 } | |
1436 } | |
1437 | |
1438 // Method was not in the appropriate compilation range. | |
1208
cef333a48af6
6923043: failed nightly tests which use -XX:+PrintCompilation -Xcomp -XX:CompileOnly
kvn
parents:
1202
diff
changeset
|
1439 method->set_not_compilable_quietly(); |
0 | 1440 return 0; |
14236 | 1441 #else |
1442 // CICountOSR is a develop flag and set to 'false' by default. In a product built, | |
1443 // only _compilation_id is incremented. | |
1444 return Atomic::add(1, &_compilation_id); | |
1445 #endif | |
0 | 1446 } |
1447 | |
1448 | |
1449 // ------------------------------------------------------------------ | |
13969
fe034af88233
Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13731
diff
changeset
|
1450 // CompileBroker::assign_compile_id_unlocked |
fe034af88233
Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13731
diff
changeset
|
1451 // |
fe034af88233
Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13731
diff
changeset
|
1452 // Public wrapper for assign_compile_id that acquires the needed locks |
fe034af88233
Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13731
diff
changeset
|
1453 uint CompileBroker::assign_compile_id_unlocked(Thread* thread, methodHandle method, int osr_bci) { |
fe034af88233
Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13731
diff
changeset
|
1454 MutexLocker locker(MethodCompileQueue_lock, thread); |
fe034af88233
Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13731
diff
changeset
|
1455 return assign_compile_id(method, osr_bci); |
fe034af88233
Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13731
diff
changeset
|
1456 } |
fe034af88233
Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13731
diff
changeset
|
1457 |
fe034af88233
Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13731
diff
changeset
|
1458 |
fe034af88233
Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13731
diff
changeset
|
1459 // ------------------------------------------------------------------ |
0 | 1460 // CompileBroker::is_compile_blocking |
1461 // | |
1462 // Should the current thread be blocked until this compilation request | |
1463 // has been fulfilled? | |
1464 bool CompileBroker::is_compile_blocking(methodHandle method, int osr_bci) { | |
6735
aed758eda82a
7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents:
6725
diff
changeset
|
1465 assert(!InstanceRefKlass::owns_pending_list_lock(JavaThread::current()), "possible deadlock"); |
3294
86ebb26bcdeb
7037756: Deadlock in compiler thread similiar to 6789220
johnc
parents:
2482
diff
changeset
|
1466 return !BackgroundCompilation; |
0 | 1467 } |
1468 | |
1469 | |
1470 // ------------------------------------------------------------------ | |
1471 // CompileBroker::preload_classes | |
1472 void CompileBroker::preload_classes(methodHandle method, TRAPS) { | |
1473 // Move this code over from c1_Compiler.cpp | |
1474 ShouldNotReachHere(); | |
1475 } | |
1476 | |
1477 | |
1478 // ------------------------------------------------------------------ | |
1479 // CompileBroker::create_compile_task | |
1480 // | |
1481 // Create a CompileTask object representing the current request for | |
1482 // compilation. Add this task to the queue. | |
1483 CompileTask* CompileBroker::create_compile_task(CompileQueue* queue, | |
1484 int compile_id, | |
1485 methodHandle method, | |
1486 int osr_bci, | |
1487 int comp_level, | |
1488 methodHandle hot_method, | |
1489 int hot_count, | |
1490 const char* comment, | |
1491 bool blocking) { | |
1492 CompileTask* new_task = allocate_task(); | |
1493 new_task->initialize(compile_id, method, osr_bci, comp_level, | |
1494 hot_method, hot_count, comment, | |
1495 blocking); | |
1496 queue->add(new_task); | |
1497 return new_task; | |
1498 } | |
1499 | |
1500 | |
1501 // ------------------------------------------------------------------ | |
1502 // CompileBroker::allocate_task | |
1503 // | |
1504 // Allocate a CompileTask, from the free list if possible. | |
1505 CompileTask* CompileBroker::allocate_task() { | |
1506 MutexLocker locker(CompileTaskAlloc_lock); | |
1507 CompileTask* task = NULL; | |
1508 if (_task_free_list != NULL) { | |
1509 task = _task_free_list; | |
1510 _task_free_list = task->next(); | |
1511 task->set_next(NULL); | |
1512 } else { | |
1513 task = new CompileTask(); | |
1514 task->set_next(NULL); | |
1515 } | |
1516 return task; | |
1517 } | |
1518 | |
1519 | |
1520 // ------------------------------------------------------------------ | |
1521 // CompileBroker::free_task | |
1522 // | |
1523 // Add a task to the free list. | |
1524 void CompileBroker::free_task(CompileTask* task) { | |
1525 MutexLocker locker(CompileTaskAlloc_lock); | |
1526 task->free(); | |
1527 task->set_next(_task_free_list); | |
1528 _task_free_list = task; | |
1529 } | |
1530 | |
1531 | |
1532 // ------------------------------------------------------------------ | |
1533 // CompileBroker::wait_for_completion | |
1534 // | |
1535 // Wait for the given method CompileTask to complete. | |
1536 void CompileBroker::wait_for_completion(CompileTask* task) { | |
1537 if (CIPrintCompileQueue) { | |
1538 tty->print_cr("BLOCKING FOR COMPILE"); | |
1539 } | |
1540 | |
1541 assert(task->is_blocking(), "can only wait on blocking task"); | |
1542 | |
1543 JavaThread *thread = JavaThread::current(); | |
1544 thread->set_blocked_on_compilation(true); | |
1545 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1546 methodHandle method(thread, task->method()); |
0 | 1547 { |
1548 MutexLocker waiter(task->lock(), thread); | |
1549 | |
1550 while (!task->is_complete()) | |
1551 task->lock()->wait(); | |
1552 } | |
1553 // It is harmless to check this status without the lock, because | |
1554 // completion is a stable property (until the task object is recycled). | |
1555 assert(task->is_complete(), "Compilation should have completed"); | |
1556 assert(task->code_handle() == NULL, "must be reset"); | |
1557 | |
1558 thread->set_blocked_on_compilation(false); | |
1559 | |
1560 // By convention, the waiter is responsible for recycling a | |
1561 // blocking CompileTask. Since there is only one waiter ever | |
1562 // waiting on a CompileTask, we know that no one else will | |
1563 // be using this CompileTask; we can free it. | |
1564 free_task(task); | |
1565 } | |
1566 | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1567 // Initialize compiler thread(s) + compiler object(s). The postcondition |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1568 // of this function is that the compiler runtimes are initialized and that |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1569 //compiler threads can start compiling. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1570 bool CompileBroker::init_compiler_runtime() { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1571 CompilerThread* thread = CompilerThread::current(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1572 AbstractCompiler* comp = thread->compiler(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1573 // Final sanity check - the compiler object must exist |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1574 guarantee(comp != NULL, "Compiler object must exist"); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1575 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1576 int system_dictionary_modification_counter; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1577 { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1578 MutexLocker locker(Compile_lock, thread); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1579 system_dictionary_modification_counter = SystemDictionary::number_of_modifications(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1580 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1581 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1582 { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1583 // Must switch to native to allocate ci_env |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1584 ThreadToNativeFromVM ttn(thread); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1585 ciEnv ci_env(NULL, system_dictionary_modification_counter); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1586 // Cache Jvmti state |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1587 ci_env.cache_jvmti_state(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1588 // Cache DTrace flags |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1589 ci_env.cache_dtrace_flags(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1590 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1591 // Switch back to VM state to do compiler initialization |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1592 ThreadInVMfromNative tv(thread); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1593 ResetNoHandleMark rnhm; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1594 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1595 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1596 if (!comp->is_shark()) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1597 // Perform per-thread and global initializations |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1598 comp->initialize(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1599 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1600 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1601 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1602 if (comp->is_failed()) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1603 disable_compilation_forever(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1604 // If compiler initialization failed, no compiler thread that is specific to a |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1605 // particular compiler runtime will ever start to compile methods. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1606 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1607 shutdown_compiler_runtime(comp, thread); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1608 return false; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1609 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1610 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1611 // C1 specific check |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1612 if (comp->is_c1() && (thread->get_buffer_blob() == NULL)) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1613 warning("Initialization of %s thread failed (no space to run compilers)", thread->name()); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1614 return false; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1615 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1616 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1617 return true; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1618 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1619 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1620 // If C1 and/or C2 initialization failed, we shut down all compilation. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1621 // We do this to keep things simple. This can be changed if it ever turns out to be |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1622 // a problem. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1623 void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1624 // Free buffer blob, if allocated |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1625 if (thread->get_buffer_blob() != NULL) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1626 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1627 CodeCache::free(thread->get_buffer_blob()); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1628 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1629 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1630 if (comp->should_perform_shutdown()) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1631 // There are two reasons for shutting down the compiler |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1632 // 1) compiler runtime initialization failed |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1633 // 2) The code cache is full and the following flag is set: -XX:-UseCodeCacheFlushing |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1634 warning("Shutting down compiler %s (no space to run compilers)", comp->name()); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1635 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1636 // Only one thread per compiler runtime object enters here |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1637 // Set state to shut down |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1638 comp->set_shut_down(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1639 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1640 MutexLocker mu(MethodCompileQueue_lock, thread); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1641 CompileQueue* queue; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1642 if (_c1_method_queue != NULL) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1643 _c1_method_queue->delete_all(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1644 queue = _c1_method_queue; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1645 _c1_method_queue = NULL; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1646 delete _c1_method_queue; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1647 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1648 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1649 if (_c2_method_queue != NULL) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1650 _c2_method_queue->delete_all(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1651 queue = _c2_method_queue; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1652 _c2_method_queue = NULL; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1653 delete _c2_method_queue; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1654 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1655 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1656 // We could delete compiler runtimes also. However, there are references to |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1657 // the compiler runtime(s) (e.g., nmethod::is_compiled_by_c1()) which then |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1658 // fail. This can be done later if necessary. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1659 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1660 } |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1661 |
0 | 1662 // ------------------------------------------------------------------ |
1663 // CompileBroker::compiler_thread_loop | |
1664 // | |
1665 // The main loop run by a CompilerThread. | |
1666 void CompileBroker::compiler_thread_loop() { | |
1667 CompilerThread* thread = CompilerThread::current(); | |
1668 CompileQueue* queue = thread->queue(); | |
1669 // For the thread that initializes the ciObjectFactory | |
1670 // this resource mark holds all the shared objects | |
1671 ResourceMark rm; | |
1672 | |
1673 // First thread to get here will initialize the compiler interface | |
1674 | |
1675 if (!ciObjectFactory::is_initialized()) { | |
1676 ASSERT_IN_VM; | |
1677 MutexLocker only_one (CompileThread_lock, thread); | |
1678 if (!ciObjectFactory::is_initialized()) { | |
1679 ciObjectFactory::initialize(); | |
1680 } | |
1681 } | |
1682 | |
1683 // Open a log. | |
1684 if (LogCompilation) { | |
1685 init_compiler_thread_log(); | |
1686 } | |
1687 CompileLog* log = thread->log(); | |
1688 if (log != NULL) { | |
6843 | 1689 log->begin_elem("start_compile_thread name='%s' thread='" UINTX_FORMAT "' process='%d'", |
1690 thread->name(), | |
0 | 1691 os::current_thread_id(), |
1692 os::current_process_id()); | |
1693 log->stamp(); | |
1694 log->end_elem(); | |
1695 } | |
1696 | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1697 // If compiler thread/runtime initialization fails, exit the compiler thread |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1698 if (!init_compiler_runtime()) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1699 return; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1700 } |
1202 | 1701 |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1702 // Poll for new compilation tasks as long as the JVM runs. Compilation |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1703 // should only be disabled if something went wrong while initializing the |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1704 // compiler runtimes. This, in turn, should not happen. The only known case |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1705 // when compiler runtime initialization fails is if there is not enough free |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1706 // space in the code cache to generate the necessary stubs, etc. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1707 while (!is_compilation_disabled_forever()) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1708 // We need this HandleMark to avoid leaking VM handles. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1709 HandleMark hm(thread); |
0 | 1710 |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1711 if (CodeCache::unallocated_capacity() < CodeCacheMinimumFreeSpace) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1712 // the code cache is really full |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1713 handle_full_code_cache(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1714 } |
0 | 1715 |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1716 CompileTask* task = queue->get(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1717 if (task == NULL) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1718 continue; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1719 } |
0 | 1720 |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1721 // Give compiler threads an extra quanta. They tend to be bursty and |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1722 // this helps the compiler to finish up the job. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1723 if( CompilerThreadHintNoPreempt ) |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1724 os::hint_no_preempt(); |
0 | 1725 |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1726 // trace per thread time and compile statistics |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1727 CompilerCounters* counters = ((CompilerThread*)thread)->counters(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1728 PerfTraceTimedEvent(counters->time_counter(), counters->compile_counter()); |
0 | 1729 |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1730 // Assign the task to the current thread. Mark this compilation |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1731 // thread as active for the profiler. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1732 CompileTaskWrapper ctw(task); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1733 nmethodLocker result_handle; // (handle for the nmethod produced by this task) |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1734 task->set_code_handle(&result_handle); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1735 methodHandle method(thread, task->method()); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1736 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1737 // Never compile a method if breakpoints are present in it |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1738 if (method()->number_of_breakpoints() == 0) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1739 // Compile the method. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1740 if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) { |
0 | 1741 #ifdef COMPILER1 |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1742 // Allow repeating compilations for the purpose of benchmarking |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1743 // compile speed. This is not useful for customers. |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1744 if (CompilationRepeat != 0) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1745 int compile_count = CompilationRepeat; |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1746 while (compile_count > 0) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1747 invoke_compiler_on_method(task); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1748 nmethod* nm = method->code(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1749 if (nm != NULL) { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1750 nm->make_zombie(); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1751 method->clear_code(); |
0 | 1752 } |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1753 compile_count--; |
0 | 1754 } |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1755 } |
0 | 1756 #endif /* COMPILER1 */ |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1757 invoke_compiler_on_method(task); |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1758 } else { |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1759 // After compilation is disabled, remove remaining methods from queue |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1760 method->clear_queued_for_compilation(); |
0 | 1761 } |
1762 } | |
1763 } | |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1764 |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1765 // Shut down compiler runtime |
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
1766 shutdown_compiler_runtime(thread->compiler(), thread); |
0 | 1767 } |
1768 | |
1769 // ------------------------------------------------------------------ | |
1770 // CompileBroker::init_compiler_thread_log | |
1771 // | |
1772 // Set up state required by +LogCompilation. | |
1773 void CompileBroker::init_compiler_thread_log() { | |
1774 CompilerThread* thread = CompilerThread::current(); | |
10394
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1775 char file_name[4*K]; |
0 | 1776 FILE* fp = NULL; |
1777 intx thread_id = os::current_thread_id(); | |
1778 for (int try_temp_dir = 1; try_temp_dir >= 0; try_temp_dir--) { | |
1779 const char* dir = (try_temp_dir ? os::get_temp_directory() : NULL); | |
1353
a2ea687fdc7c
6938627: Make temporary directory use property java.io.tmpdir when specified
coleenp
parents:
1300
diff
changeset
|
1780 if (dir == NULL) { |
10394
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1781 jio_snprintf(file_name, sizeof(file_name), "hs_c" UINTX_FORMAT "_pid%u.log", |
1353
a2ea687fdc7c
6938627: Make temporary directory use property java.io.tmpdir when specified
coleenp
parents:
1300
diff
changeset
|
1782 thread_id, os::current_process_id()); |
a2ea687fdc7c
6938627: Make temporary directory use property java.io.tmpdir when specified
coleenp
parents:
1300
diff
changeset
|
1783 } else { |
10394
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1784 jio_snprintf(file_name, sizeof(file_name), |
1353
a2ea687fdc7c
6938627: Make temporary directory use property java.io.tmpdir when specified
coleenp
parents:
1300
diff
changeset
|
1785 "%s%shs_c" UINTX_FORMAT "_pid%u.log", dir, |
a2ea687fdc7c
6938627: Make temporary directory use property java.io.tmpdir when specified
coleenp
parents:
1300
diff
changeset
|
1786 os::file_separator(), thread_id, os::current_process_id()); |
a2ea687fdc7c
6938627: Make temporary directory use property java.io.tmpdir when specified
coleenp
parents:
1300
diff
changeset
|
1787 } |
10394
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1788 |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1789 fp = fopen(file_name, "at"); |
0 | 1790 if (fp != NULL) { |
10394
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1791 if (LogCompilation && Verbose) { |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1792 tty->print_cr("Opening compilation log %s", file_name); |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1793 } |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1794 CompileLog* log = new(ResourceObj::C_HEAP, mtCompiler) CompileLog(file_name, fp, thread_id); |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1795 thread->init_log(log); |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1796 |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1797 if (xtty != NULL) { |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1798 ttyLocker ttyl; |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1799 // Record any per thread log files |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1800 xtty->elem("thread_logfile thread='%d' filename='%s'", thread_id, file_name); |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1801 } |
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1802 return; |
0 | 1803 } |
1804 } | |
10394
813f26e34135
8013329: File leak in hotspot/src/share/vm/compiler/compileBroker.cpp
anoll
parents:
10278
diff
changeset
|
1805 warning("Cannot open log file: %s", file_name); |
0 | 1806 } |
1807 | |
1808 // ------------------------------------------------------------------ | |
1809 // CompileBroker::set_should_block | |
1810 // | |
1811 // Set _should_block. | |
1812 // Call this from the VM, with Threads_lock held and a safepoint requested. | |
1813 void CompileBroker::set_should_block() { | |
1814 assert(Threads_lock->owner() == Thread::current(), "must have threads lock"); | |
1815 assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint already"); | |
1816 #ifndef PRODUCT | |
1817 if (PrintCompilation && (Verbose || WizardMode)) | |
1818 tty->print_cr("notifying compiler thread pool to block"); | |
1819 #endif | |
1820 _should_block = true; | |
1821 } | |
1822 | |
1823 // ------------------------------------------------------------------ | |
1824 // CompileBroker::maybe_block | |
1825 // | |
1826 // Call this from the compiler at convenient points, to poll for _should_block. | |
1827 void CompileBroker::maybe_block() { | |
1828 if (_should_block) { | |
1829 #ifndef PRODUCT | |
1830 if (PrintCompilation && (Verbose || WizardMode)) | |
1831 tty->print_cr("compiler thread " INTPTR_FORMAT " poll detects block request", Thread::current()); | |
1832 #endif | |
1833 ThreadInVMfromNative tivfn(JavaThread::current()); | |
1834 } | |
1835 } | |
1836 | |
7595
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1837 // wrapper for CodeCache::print_summary() |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1838 static void codecache_print(bool detailed) |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1839 { |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1840 ResourceMark rm; |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1841 stringStream s; |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1842 // Dump code cache into a buffer before locking the tty, |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1843 { |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1844 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1845 CodeCache::print_summary(&s, detailed); |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1846 } |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1847 ttyLocker ttyl; |
12158
766fac3395d6
8012972: Incremental Inlining should support scalar replaced object in debug info
kvn
parents:
10405
diff
changeset
|
1848 tty->print(s.as_string()); |
7595
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1849 } |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1850 |
0 | 1851 // ------------------------------------------------------------------ |
1852 // CompileBroker::invoke_compiler_on_method | |
1853 // | |
1854 // Compile a method. | |
1855 // | |
1856 void CompileBroker::invoke_compiler_on_method(CompileTask* task) { | |
1857 if (PrintCompilation) { | |
1858 ResourceMark rm; | |
1859 task->print_line(); | |
1860 } | |
1861 elapsedTimer time; | |
1862 | |
1863 CompilerThread* thread = CompilerThread::current(); | |
1864 ResourceMark rm(thread); | |
1865 | |
4872
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1866 if (LogEvents) { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1867 _compilation_log->log_compile(thread, task); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1868 } |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1869 |
0 | 1870 // Common flags. |
1871 uint compile_id = task->compile_id(); | |
1872 int osr_bci = task->osr_bci(); | |
1873 bool is_osr = (osr_bci != standard_entry_bci); | |
1874 bool should_log = (thread->log() != NULL); | |
1875 bool should_break = false; | |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1876 int task_level = task->comp_level(); |
0 | 1877 { |
1878 // create the handle inside it's own block so it can't | |
1879 // accidentally be referenced once the thread transitions to | |
1880 // native. The NoHandleMark before the transition should catch | |
1881 // any cases where this occurs in the future. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1882 methodHandle method(thread, task->method()); |
0 | 1883 should_break = check_break_at(method, compile_id, is_osr); |
1884 if (should_log && !CompilerOracle::should_log(method)) { | |
1885 should_log = false; | |
1886 } | |
1887 assert(!method->is_native(), "no longer compile natives"); | |
1888 | |
1889 // Save information about this method in case of failure. | |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1890 set_last_compile(thread, method, is_osr, task_level); |
0 | 1891 |
10207
e4e131b15d5c
8013532: Remove unused parameter "compiler" from DTRACE_METHOD_COMPILE* macros
roland
parents:
10206
diff
changeset
|
1892 DTRACE_METHOD_COMPILE_BEGIN_PROBE(method, compiler_name(task_level)); |
0 | 1893 } |
1894 | |
1895 // Allocate a new set of JNI handles. | |
1896 push_jni_handle_block(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1897 Method* target_handle = task->method(); |
0 | 1898 int compilable = ciEnv::MethodCompilable; |
1899 { | |
1900 int system_dictionary_modification_counter; | |
1901 { | |
1902 MutexLocker locker(Compile_lock, thread); | |
1903 system_dictionary_modification_counter = SystemDictionary::number_of_modifications(); | |
1904 } | |
1905 | |
1906 NoHandleMark nhm; | |
1907 ThreadToNativeFromVM ttn(thread); | |
1908 | |
1909 ciEnv ci_env(task, system_dictionary_modification_counter); | |
1910 if (should_break) { | |
1911 ci_env.set_break_at_compile(true); | |
1912 } | |
1913 if (should_log) { | |
1914 ci_env.set_log(thread->log()); | |
1915 } | |
1916 assert(thread->env() == &ci_env, "set by ci_env"); | |
1917 // The thread-env() field is cleared in ~CompileTaskWrapper. | |
1918 | |
780
c96bf21b756f
6788527: Server vm intermittently fails with assertion "live value must not be garbage" with fastdebug bits
kvn
parents:
0
diff
changeset
|
1919 // Cache Jvmti state |
c96bf21b756f
6788527: Server vm intermittently fails with assertion "live value must not be garbage" with fastdebug bits
kvn
parents:
0
diff
changeset
|
1920 ci_env.cache_jvmti_state(); |
c96bf21b756f
6788527: Server vm intermittently fails with assertion "live value must not be garbage" with fastdebug bits
kvn
parents:
0
diff
changeset
|
1921 |
c96bf21b756f
6788527: Server vm intermittently fails with assertion "live value must not be garbage" with fastdebug bits
kvn
parents:
0
diff
changeset
|
1922 // Cache DTrace flags |
c96bf21b756f
6788527: Server vm intermittently fails with assertion "live value must not be garbage" with fastdebug bits
kvn
parents:
0
diff
changeset
|
1923 ci_env.cache_dtrace_flags(); |
c96bf21b756f
6788527: Server vm intermittently fails with assertion "live value must not be garbage" with fastdebug bits
kvn
parents:
0
diff
changeset
|
1924 |
0 | 1925 ciMethod* target = ci_env.get_method_from_handle(target_handle); |
1926 | |
1927 TraceTime t1("compilation", &time); | |
10405 | 1928 EventCompilation event; |
0 | 1929 |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1930 AbstractCompiler *comp = compiler(task_level); |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1931 if (comp == NULL) { |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1932 ci_env.record_method_not_compilable("no compiler", !TieredCompilation); |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1933 } else { |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1934 comp->compile_method(&ci_env, target, osr_bci); |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
1935 } |
0 | 1936 |
1937 if (!ci_env.failing() && task->code() == NULL) { | |
1938 //assert(false, "compiler should always document failure"); | |
1939 // The compiler elected, without comment, not to register a result. | |
1940 // Do not attempt further compilations of this method. | |
1964
22ef3370343b
7000349: Tiered reacts incorrectly to C1 compilation failures
iveresov
parents:
1783
diff
changeset
|
1941 ci_env.record_method_not_compilable("compile failed", !TieredCompilation); |
0 | 1942 } |
1943 | |
4872
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1944 // Copy this bit to the enclosing block: |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1945 compilable = ci_env.compilable(); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1946 |
0 | 1947 if (ci_env.failing()) { |
4872
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1948 const char* retry_message = ci_env.retry_message(); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1949 if (_compilation_log != NULL) { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1950 _compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1951 } |
0 | 1952 if (PrintCompilation) { |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
1953 FormatBufferResource msg = retry_message != NULL ? |
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
1954 err_msg_res("COMPILE SKIPPED: %s (%s)", ci_env.failure_reason(), retry_message) : |
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
1955 err_msg_res("COMPILE SKIPPED: %s", ci_env.failure_reason()); |
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
1956 task->print_compilation(tty, msg); |
0 | 1957 } |
1958 } else { | |
1959 task->mark_success(); | |
1960 task->set_num_inlined_bytecodes(ci_env.num_inlined_bytecodes()); | |
4872
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1961 if (_compilation_log != NULL) { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1962 nmethod* code = task->code(); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1963 if (code != NULL) { |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1964 _compilation_log->log_nmethod(thread, code); |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1965 } |
aa3d708d67c4
7141200: log some interesting information in ring buffers for crashes
never
parents:
4825
diff
changeset
|
1966 } |
0 | 1967 } |
10197
7b23cb975cf2
8011675: adding compilation level to replay data
iignatyev
parents:
10114
diff
changeset
|
1968 // simulate crash during compilation |
7b23cb975cf2
8011675: adding compilation level to replay data
iignatyev
parents:
10114
diff
changeset
|
1969 assert(task->compile_id() != CICrashAt, "just as planned"); |
10405 | 1970 if (event.should_commit()) { |
1971 event.set_method(target->get_Method()); | |
1972 event.set_compileID(compile_id); | |
1973 event.set_compileLevel(task->comp_level()); | |
1974 event.set_succeded(task->is_success()); | |
1975 event.set_isOsr(is_osr); | |
1976 event.set_codeSize((task->code() == NULL) ? 0 : task->code()->total_size()); | |
1977 event.set_inlinedBytes(task->num_inlined_bytecodes()); | |
1978 event.commit(); | |
1979 } | |
0 | 1980 } |
1981 pop_jni_handle_block(); | |
1982 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
1983 methodHandle method(thread, task->method()); |
0 | 1984 |
10207
e4e131b15d5c
8013532: Remove unused parameter "compiler" from DTRACE_METHOD_COMPILE* macros
roland
parents:
10206
diff
changeset
|
1985 DTRACE_METHOD_COMPILE_END_PROBE(method, compiler_name(task_level), task->is_success()); |
0 | 1986 |
1987 collect_statistics(thread, time, task); | |
1988 | |
4064
670a74b863fc
7107042: assert(no_dead_loop) failed: dead loop detected
kvn
parents:
4047
diff
changeset
|
1989 if (PrintCompilation && PrintCompilation2) { |
4047 | 1990 tty->print("%7d ", (int) tty->time_stamp().milliseconds()); // print timestamp |
1991 tty->print("%4d ", compile_id); // print compilation number | |
1992 tty->print("%s ", (is_osr ? "%" : " ")); | |
10278 | 1993 if (task->code() != NULL) { |
1994 tty->print("size: %d(%d) ", task->code()->total_size(), task->code()->insts_size()); | |
1995 } | |
1996 tty->print_cr("time: %d inlined: %d bytes", (int)time.milliseconds(), task->num_inlined_bytecodes()); | |
4047 | 1997 } |
1998 | |
7595
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
1999 if (PrintCodeCacheOnCompilation) |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
2000 codecache_print(/* detailed= */ false); |
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
2001 |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
2002 // Disable compilation, if required. |
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
2003 switch (compilable) { |
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
2004 case ciEnv::MethodCompilable_never: |
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
2005 if (is_osr) |
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
2006 method->set_not_osr_compilable_quietly(); |
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
2007 else |
1208
cef333a48af6
6923043: failed nightly tests which use -XX:+PrintCompilation -Xcomp -XX:CompileOnly
kvn
parents:
1202
diff
changeset
|
2008 method->set_not_compilable_quietly(); |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
2009 break; |
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
2010 case ciEnv::MethodCompilable_not_at_tier: |
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
2011 if (is_osr) |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2012 method->set_not_osr_compilable_quietly(task_level); |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
2013 else |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2014 method->set_not_compilable_quietly(task_level); |
6800
9191895df19d
7200001: failed C1 OSR compile doesn't get recompiled with C2
twisti
parents:
6735
diff
changeset
|
2015 break; |
0 | 2016 } |
2017 | |
2018 // Note that the queued_for_compilation bits are cleared without | |
2019 // protection of a mutex. [They were set by the requester thread, | |
2020 // when adding the task to the complie queue -- at which time the | |
2021 // compile queue lock was held. Subsequently, we acquired the compile | |
2022 // queue lock to get this task off the compile queue; thus (to belabour | |
2023 // the point somewhat) our clearing of the bits must be occurring | |
2024 // only after the setting of the bits. See also 14012000 above. | |
2025 method->clear_queued_for_compilation(); | |
2026 | |
2027 #ifdef ASSERT | |
2028 if (CollectedHeap::fired_fake_oom()) { | |
2029 // The current compile received a fake OOM during compilation so | |
2030 // go ahead and exit the VM since the test apparently succeeded | |
2031 tty->print_cr("*** Shutting down VM after successful fake OOM"); | |
2032 vm_exit(0); | |
2033 } | |
2034 #endif | |
2035 } | |
2036 | |
13074
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2037 /** |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2038 * The CodeCache is full. Print out warning and disable compilation |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2039 * or try code cache cleaning so compilation can continue later. |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2040 */ |
1202 | 2041 void CompileBroker::handle_full_code_cache() { |
2042 UseInterpreter = true; | |
2043 if (UseCompiler || AlwaysCompileLoopMethods ) { | |
1728
a62d332029cf
6976372: # assert(_owner == Thread::current()) failed: invariant
never
parents:
1692
diff
changeset
|
2044 if (xtty != NULL) { |
7595
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
2045 ResourceMark rm; |
2482
dbccacb79c63
7036236: VM crashes assert((!inside_attrs()) || is_error_reported()) failed ...
iveresov
parents:
2447
diff
changeset
|
2046 stringStream s; |
dbccacb79c63
7036236: VM crashes assert((!inside_attrs()) || is_error_reported()) failed ...
iveresov
parents:
2447
diff
changeset
|
2047 // Dump code cache state into a buffer before locking the tty, |
dbccacb79c63
7036236: VM crashes assert((!inside_attrs()) || is_error_reported()) failed ...
iveresov
parents:
2447
diff
changeset
|
2048 // because log_state() will use locks causing lock conflicts. |
dbccacb79c63
7036236: VM crashes assert((!inside_attrs()) || is_error_reported()) failed ...
iveresov
parents:
2447
diff
changeset
|
2049 CodeCache::log_state(&s); |
dbccacb79c63
7036236: VM crashes assert((!inside_attrs()) || is_error_reported()) failed ...
iveresov
parents:
2447
diff
changeset
|
2050 // Lock to prevent tearing |
dbccacb79c63
7036236: VM crashes assert((!inside_attrs()) || is_error_reported()) failed ...
iveresov
parents:
2447
diff
changeset
|
2051 ttyLocker ttyl; |
1728
a62d332029cf
6976372: # assert(_owner == Thread::current()) failed: invariant
never
parents:
1692
diff
changeset
|
2052 xtty->begin_elem("code_cache_full"); |
2482
dbccacb79c63
7036236: VM crashes assert((!inside_attrs()) || is_error_reported()) failed ...
iveresov
parents:
2447
diff
changeset
|
2053 xtty->print(s.as_string()); |
1728
a62d332029cf
6976372: # assert(_owner == Thread::current()) failed: invariant
never
parents:
1692
diff
changeset
|
2054 xtty->stamp(); |
a62d332029cf
6976372: # assert(_owner == Thread::current()) failed: invariant
never
parents:
1692
diff
changeset
|
2055 xtty->end_elem(); |
1202 | 2056 } |
10405 | 2057 |
2058 CodeCache::report_codemem_full(); | |
2059 | |
1578
ca3dceda776c
6930994: Code cache is full warning should be visible in product
never
parents:
1538
diff
changeset
|
2060 #ifndef PRODUCT |
1202 | 2061 if (CompileTheWorld || ExitOnFullCodeCache) { |
7595
9deda4d8e126
8005204: Code Cache Reduction: command line options implementation
vladidan
parents:
7409
diff
changeset
|
2062 codecache_print(/* detailed= */ true); |
1202 | 2063 before_exit(JavaThread::current()); |
2064 exit_globals(); // will delete tty | |
2065 vm_direct_exit(CompileTheWorld ? 0 : 1); | |
2066 } | |
1578
ca3dceda776c
6930994: Code cache is full warning should be visible in product
never
parents:
1538
diff
changeset
|
2067 #endif |
1202 | 2068 if (UseCodeCacheFlushing) { |
12324
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
2069 // Since code cache is full, immediately stop new compiles |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
2070 if (CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation)) { |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
2071 NMethodSweeper::log_sweep("disable_compiler"); |
510fbd28919c
8020151: PSR:PERF Large performance regressions when code cache is filled
anoll
parents:
12158
diff
changeset
|
2072 } |
13074
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2073 // Switch to 'vm_state'. This ensures that possibly_sweep() can be called |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2074 // without having to consider the state in which the current thread is. |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2075 ThreadInVMfromUnknown in_vm; |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2076 NMethodSweeper::possibly_sweep(); |
1202 | 2077 } else { |
12880
469216acdb28
8023014: CodeSweeperSweepNoFlushTest.java fails with HS crash
anoll
parents:
12861
diff
changeset
|
2078 disable_compilation_forever(); |
1202 | 2079 } |
13074
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2080 |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2081 // Print warning only once |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2082 if (should_print_compiler_warning()) { |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2083 warning("CodeCache is full. Compiler has been disabled."); |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2084 warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize="); |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2085 codecache_print(/* detailed= */ true); |
78da3894b86f
8027593: performance drop with constrained codecache starting with hs25 b111
anoll
parents:
13016
diff
changeset
|
2086 } |
1202 | 2087 } |
2088 } | |
2089 | |
2090 // ------------------------------------------------------------------ | |
0 | 2091 // CompileBroker::set_last_compile |
2092 // | |
2093 // Record this compilation for debugging purposes. | |
2094 void CompileBroker::set_last_compile(CompilerThread* thread, methodHandle method, bool is_osr, int comp_level) { | |
2095 ResourceMark rm; | |
2096 char* method_name = method->name()->as_C_string(); | |
2097 strncpy(_last_method_compiled, method_name, CompileBroker::name_buffer_length); | |
2098 char current_method[CompilerCounters::cmname_buffer_length]; | |
2099 size_t maxLen = CompilerCounters::cmname_buffer_length; | |
2100 | |
2101 if (UsePerfData) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2102 const char* class_name = method->method_holder()->name()->as_C_string(); |
0 | 2103 |
2104 size_t s1len = strlen(class_name); | |
2105 size_t s2len = strlen(method_name); | |
2106 | |
2107 // check if we need to truncate the string | |
2108 if (s1len + s2len + 2 > maxLen) { | |
2109 | |
2110 // the strategy is to lop off the leading characters of the | |
2111 // class name and the trailing characters of the method name. | |
2112 | |
2113 if (s2len + 2 > maxLen) { | |
2114 // lop of the entire class name string, let snprintf handle | |
2115 // truncation of the method name. | |
2116 class_name += s1len; // null string | |
2117 } | |
2118 else { | |
2119 // lop off the extra characters from the front of the class name | |
2120 class_name += ((s1len + s2len + 2) - maxLen); | |
2121 } | |
2122 } | |
2123 | |
2124 jio_snprintf(current_method, maxLen, "%s %s", class_name, method_name); | |
2125 } | |
2126 | |
2127 if (CICountOSR && is_osr) { | |
2128 _last_compile_type = osr_compile; | |
2129 } else { | |
2130 _last_compile_type = normal_compile; | |
2131 } | |
2132 _last_compile_level = comp_level; | |
2133 | |
2134 if (UsePerfData) { | |
2135 CompilerCounters* counters = thread->counters(); | |
2136 counters->set_current_method(current_method); | |
2137 counters->set_compile_type((jlong)_last_compile_type); | |
2138 } | |
2139 } | |
2140 | |
2141 | |
2142 // ------------------------------------------------------------------ | |
2143 // CompileBroker::push_jni_handle_block | |
2144 // | |
2145 // Push on a new block of JNI handles. | |
2146 void CompileBroker::push_jni_handle_block() { | |
2147 JavaThread* thread = JavaThread::current(); | |
2148 | |
2149 // Allocate a new block for JNI handles. | |
2150 // Inlined code from jni_PushLocalFrame() | |
2151 JNIHandleBlock* java_handles = thread->active_handles(); | |
2152 JNIHandleBlock* compile_handles = JNIHandleBlock::allocate_block(thread); | |
2153 assert(compile_handles != NULL && java_handles != NULL, "should not be NULL"); | |
2154 compile_handles->set_pop_frame_link(java_handles); // make sure java handles get gc'd. | |
2155 thread->set_active_handles(compile_handles); | |
2156 } | |
2157 | |
2158 | |
2159 // ------------------------------------------------------------------ | |
2160 // CompileBroker::pop_jni_handle_block | |
2161 // | |
2162 // Pop off the current block of JNI handles. | |
2163 void CompileBroker::pop_jni_handle_block() { | |
2164 JavaThread* thread = JavaThread::current(); | |
2165 | |
2166 // Release our JNI handle block | |
2167 JNIHandleBlock* compile_handles = thread->active_handles(); | |
2168 JNIHandleBlock* java_handles = compile_handles->pop_frame_link(); | |
2169 thread->set_active_handles(java_handles); | |
2170 compile_handles->set_pop_frame_link(NULL); | |
2171 JNIHandleBlock::release_block(compile_handles, thread); // may block | |
2172 } | |
2173 | |
2174 | |
2175 // ------------------------------------------------------------------ | |
2176 // CompileBroker::check_break_at | |
2177 // | |
2178 // Should the compilation break at the current compilation. | |
2179 bool CompileBroker::check_break_at(methodHandle method, int compile_id, bool is_osr) { | |
2180 if (CICountOSR && is_osr && (compile_id == CIBreakAtOSR)) { | |
2181 return true; | |
2182 } else if( CompilerOracle::should_break_at(method) ) { // break when compiling | |
2183 return true; | |
2184 } else { | |
2185 return (compile_id == CIBreakAt); | |
2186 } | |
2187 } | |
2188 | |
2189 // ------------------------------------------------------------------ | |
2190 // CompileBroker::collect_statistics | |
2191 // | |
2192 // Collect statistics about the compilation. | |
2193 | |
2194 void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time, CompileTask* task) { | |
2195 bool success = task->is_success(); | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
6266
diff
changeset
|
2196 methodHandle method (thread, task->method()); |
0 | 2197 uint compile_id = task->compile_id(); |
2198 bool is_osr = (task->osr_bci() != standard_entry_bci); | |
2199 nmethod* code = task->code(); | |
2200 CompilerCounters* counters = thread->counters(); | |
2201 | |
2202 assert(code == NULL || code->is_locked_by_vm(), "will survive the MutexLocker"); | |
2203 MutexLocker locker(CompileStatistics_lock); | |
2204 | |
2205 // _perf variables are production performance counters which are | |
2206 // updated regardless of the setting of the CITime and CITimeEach flags | |
2207 // | |
2208 if (!success) { | |
2209 _total_bailout_count++; | |
2210 if (UsePerfData) { | |
2211 _perf_last_failed_method->set_value(counters->current_method()); | |
2212 _perf_last_failed_type->set_value(counters->compile_type()); | |
2213 _perf_total_bailout_count->inc(); | |
2214 } | |
2215 } else if (code == NULL) { | |
2216 if (UsePerfData) { | |
2217 _perf_last_invalidated_method->set_value(counters->current_method()); | |
2218 _perf_last_invalidated_type->set_value(counters->compile_type()); | |
2219 _perf_total_invalidated_count->inc(); | |
2220 } | |
2221 _total_invalidated_count++; | |
2222 } else { | |
2223 // Compilation succeeded | |
2224 | |
2225 // update compilation ticks - used by the implementation of | |
2226 // java.lang.management.CompilationMBean | |
2227 _perf_total_compilation->inc(time.ticks()); | |
2228 | |
10405 | 2229 _t_total_compilation.add(time); |
2230 _peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time; | |
2231 | |
0 | 2232 if (CITime) { |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2233 int bytes_compiled = method->code_size() + task->num_inlined_bytecodes(); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2234 GRAAL_ONLY(CompilerStatistics* stats = compiler(task->comp_level())->stats();) |
0 | 2235 if (is_osr) { |
2236 _t_osr_compilation.add(time); | |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2237 _sum_osr_bytes_compiled += bytes_compiled; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2238 GRAAL_ONLY(stats->_osr.update(time, bytes_compiled);) |
0 | 2239 } else { |
2240 _t_standard_compilation.add(time); | |
2241 _sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes(); | |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2242 GRAAL_ONLY(stats->_standard.update(time, bytes_compiled);) |
0 | 2243 } |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2244 GRAAL_ONLY(stats->_nmethods_size += code->total_size();) |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2245 GRAAL_ONLY(stats->_nmethods_code_size += code->insts_size();) |
0 | 2246 } |
2247 | |
2248 if (UsePerfData) { | |
2249 // save the name of the last method compiled | |
2250 _perf_last_method->set_value(counters->current_method()); | |
2251 _perf_last_compile_type->set_value(counters->compile_type()); | |
2252 _perf_last_compile_size->set_value(method->code_size() + | |
2253 task->num_inlined_bytecodes()); | |
2254 if (is_osr) { | |
2255 _perf_osr_compilation->inc(time.ticks()); | |
2256 _perf_sum_osr_bytes_compiled->inc(method->code_size() + task->num_inlined_bytecodes()); | |
2257 } else { | |
2258 _perf_standard_compilation->inc(time.ticks()); | |
2259 _perf_sum_standard_bytes_compiled->inc(method->code_size() + task->num_inlined_bytecodes()); | |
2260 } | |
2261 } | |
2262 | |
2263 if (CITimeEach) { | |
2264 float bytes_per_sec = 1.0 * (method->code_size() + task->num_inlined_bytecodes()) / time.seconds(); | |
2265 tty->print_cr("%3d seconds: %f bytes/sec : %f (bytes %d + %d inlined)", | |
2266 compile_id, time.seconds(), bytes_per_sec, method->code_size(), task->num_inlined_bytecodes()); | |
2267 } | |
2268 | |
2269 // Collect counts of successful compilations | |
1748 | 2270 _sum_nmethod_size += code->total_size(); |
2271 _sum_nmethod_code_size += code->insts_size(); | |
0 | 2272 _total_compile_count++; |
2273 | |
2274 if (UsePerfData) { | |
1748 | 2275 _perf_sum_nmethod_size->inc( code->total_size()); |
2276 _perf_sum_nmethod_code_size->inc(code->insts_size()); | |
0 | 2277 _perf_total_compile_count->inc(); |
2278 } | |
2279 | |
2280 if (is_osr) { | |
2281 if (UsePerfData) _perf_total_osr_compile_count->inc(); | |
2282 _total_osr_compile_count++; | |
2283 } else { | |
2284 if (UsePerfData) _perf_total_standard_compile_count->inc(); | |
2285 _total_standard_compile_count++; | |
2286 } | |
2287 } | |
2288 // set the current method for the thread to null | |
2289 if (UsePerfData) counters->set_current_method(""); | |
2290 } | |
2291 | |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2292 const char* CompileBroker::compiler_name(int comp_level) { |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2293 AbstractCompiler *comp = CompileBroker::compiler(comp_level); |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2294 if (comp == NULL) { |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2295 return "no compiler"; |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2296 } else { |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2297 return (comp->name()); |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2298 } |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2299 } |
0 | 2300 |
13364
5a4293f24642
added -G:PrintCompRate option for periodically printing out the current compilation rate
Doug Simon <doug.simon@oracle.com>
parents:
13107
diff
changeset
|
2301 void CompileBroker::print_times(bool per_compiler, bool aggregate) { |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2302 #ifdef GRAAL |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2303 elapsedTimer standard_compilation; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2304 elapsedTimer total_compilation; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2305 elapsedTimer osr_compilation; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2306 |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2307 int standard_bytes_compiled = 0; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2308 int osr_bytes_compiled = 0; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2309 |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2310 int standard_compile_count = 0; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2311 int osr_compile_count = 0; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2312 int total_compile_count = 0; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2313 |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2314 int nmethods_size = 0; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2315 int nmethods_code_size = 0; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2316 bool printedHeader = false; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2317 |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2318 for (unsigned int i = 0; i < sizeof(_compilers) / sizeof(AbstractCompiler*); i++) { |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2319 AbstractCompiler* comp = _compilers[i]; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2320 if (comp != NULL) { |
13364
5a4293f24642
added -G:PrintCompRate option for periodically printing out the current compilation rate
Doug Simon <doug.simon@oracle.com>
parents:
13107
diff
changeset
|
2321 if (per_compiler && aggregate && !printedHeader) { |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2322 printedHeader = true; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2323 tty->cr(); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2324 tty->print_cr("Individual compiler times (for compiled methods only)"); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2325 tty->print_cr("------------------------------------------------"); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2326 tty->cr(); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2327 } |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2328 CompilerStatistics* stats = comp->stats(); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2329 |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2330 standard_compilation.add(stats->_standard._time); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2331 osr_compilation.add(stats->_osr._time); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2332 |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2333 standard_bytes_compiled += stats->_standard._bytes; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2334 osr_bytes_compiled += stats->_osr._bytes; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2335 |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2336 standard_compile_count += stats->_standard._count; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2337 osr_compile_count += stats->_osr._count; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2338 |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2339 nmethods_size += stats->_nmethods_size; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2340 nmethods_code_size += stats->_nmethods_code_size; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2341 |
13364
5a4293f24642
added -G:PrintCompRate option for periodically printing out the current compilation rate
Doug Simon <doug.simon@oracle.com>
parents:
13107
diff
changeset
|
2342 if (per_compiler) { |
14107
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
2343 tty->print_cr(" %s {speed: %d bytes/s; standard: %6.3f s, %d bytes, %d methods; osr: %6.3f s, %d bytes, %d methods; nmethods_size: %d bytes; nmethods_code_size: %d bytes}", |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
2344 comp->name(), stats->bytes_per_second(), |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
2345 stats->_standard._time.seconds(), stats->_standard._bytes, stats->_standard._count, |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
2346 stats->_osr._time.seconds(), stats->_osr._bytes, stats->_osr._count, |
800057208a2c
enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13969
diff
changeset
|
2347 stats->_nmethods_size, stats->_nmethods_code_size); |
13364
5a4293f24642
added -G:PrintCompRate option for periodically printing out the current compilation rate
Doug Simon <doug.simon@oracle.com>
parents:
13107
diff
changeset
|
2348 } |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2349 } |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2350 } |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2351 total_compile_count = osr_compile_count + standard_compile_count; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2352 total_compilation.add(osr_compilation); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2353 total_compilation.add(standard_compilation); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2354 #else |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2355 elapsedTimer standard_compilation = CompileBroker::_t_standard_compilation; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2356 elapsedTimer osr_compilation = CompileBroker::_t_osr_compilation; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2357 elapsedTimer total_compilation = CompileBroker::_t_total_compilation; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2358 |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2359 int standard_bytes_compiled = CompileBroker::_sum_standard_bytes_compiled; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2360 int osr_bytes_compiled = CompileBroker::_sum_osr_bytes_compiled; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2361 |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2362 int standard_compile_count = CompileBroker::_total_standard_compile_count; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2363 int osr_compile_count = CompileBroker::_total_osr_compile_count; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2364 int total_compile_count = CompileBroker::_total_compile_count; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2365 |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2366 int nmethods_size = CompileBroker::_sum_nmethod_code_size; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2367 int nmethods_code_size = CompileBroker::_sum_nmethod_size; |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2368 #endif |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2369 |
13364
5a4293f24642
added -G:PrintCompRate option for periodically printing out the current compilation rate
Doug Simon <doug.simon@oracle.com>
parents:
13107
diff
changeset
|
2370 if (!aggregate) { |
5a4293f24642
added -G:PrintCompRate option for periodically printing out the current compilation rate
Doug Simon <doug.simon@oracle.com>
parents:
13107
diff
changeset
|
2371 return; |
5a4293f24642
added -G:PrintCompRate option for periodically printing out the current compilation rate
Doug Simon <doug.simon@oracle.com>
parents:
13107
diff
changeset
|
2372 } |
0 | 2373 tty->cr(); |
2374 tty->print_cr("Accumulated compiler times (for compiled methods only)"); | |
2375 tty->print_cr("------------------------------------------------"); | |
2376 //0000000000111111111122222222223333333333444444444455555555556666666666 | |
2377 //0123456789012345678901234567890123456789012345678901234567890123456789 | |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2378 tty->print_cr(" Total compilation time : %6.3f s", total_compilation.seconds()); |
0 | 2379 tty->print_cr(" Standard compilation : %6.3f s, Average : %2.3f", |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2380 standard_compilation.seconds(), |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2381 standard_compilation.seconds() / standard_compile_count); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2382 tty->print_cr(" On stack replacement : %6.3f s, Average : %2.3f", osr_compilation.seconds(), osr_compilation.seconds() / osr_compile_count); |
1131 | 2383 |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2384 AbstractCompiler *comp = compiler(CompLevel_simple); |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2385 if (comp != NULL) { |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2386 comp->print_timers(); |
0 | 2387 } |
8771
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2388 comp = compiler(CompLevel_full_optimization); |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2389 if (comp != NULL) { |
75a28f465a12
8008663: [parfait] Null pointer deference in hotspot/src/share/vm/compiler/compileBroker.cpp
morris
parents:
8730
diff
changeset
|
2390 comp->print_timers(); |
1783 | 2391 } |
0 | 2392 tty->cr(); |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2393 tty->print_cr(" Total compiled methods : %6d methods", total_compile_count); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2394 tty->print_cr(" Standard compilation : %6d methods", standard_compile_count); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2395 tty->print_cr(" On stack replacement : %6d methods", osr_compile_count); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2396 int tcb = osr_bytes_compiled + standard_bytes_compiled; |
0 | 2397 tty->print_cr(" Total compiled bytecodes : %6d bytes", tcb); |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2398 tty->print_cr(" Standard compilation : %6d bytes", standard_bytes_compiled); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2399 tty->print_cr(" On stack replacement : %6d bytes", osr_bytes_compiled); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2400 double tcs = total_compilation.seconds(); |
7568
140d4d4ab3b9
added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents:
7482
diff
changeset
|
2401 int bps = tcs == 0.0 ? 0 : (int)(tcb / tcs); |
0 | 2402 tty->print_cr(" Average compilation speed: %6d bytes/s", bps); |
2403 tty->cr(); | |
12779
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2404 tty->print_cr(" nmethod code size : %6d bytes", nmethods_code_size); |
f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
Doug Simon <doug.simon@oracle.com>
parents:
12356
diff
changeset
|
2405 tty->print_cr(" nmethod total size : %6d bytes", nmethods_size); |
0 | 2406 } |
2407 | |
2408 // Debugging output for failure | |
2409 void CompileBroker::print_last_compile() { | |
2410 if ( _last_compile_level != CompLevel_none && | |
2411 compiler(_last_compile_level) != NULL && | |
2412 _last_method_compiled != NULL && | |
2413 _last_compile_type != no_compile) { | |
2414 if (_last_compile_type == osr_compile) { | |
2415 tty->print_cr("Last parse: [osr]%d+++(%d) %s", | |
2416 _osr_compilation_id, _last_compile_level, _last_method_compiled); | |
2417 } else { | |
2418 tty->print_cr("Last parse: %d+++(%d) %s", | |
2419 _compilation_id, _last_compile_level, _last_method_compiled); | |
2420 } | |
2421 } | |
2422 } | |
2423 | |
2424 | |
2425 void CompileBroker::print_compiler_threads_on(outputStream* st) { | |
2426 #ifndef PRODUCT | |
2427 st->print_cr("Compiler thread printing unimplemented."); | |
2428 st->cr(); | |
2429 #endif | |
2430 } |