166 print(st);
167 }
168
169 // ------------------------------------------------------------------
170 // CompileTask::print_tty
171 void CompileTask::print_tty() {
172 ttyLocker ttyl; // keep the following output all in one block
173 // print compiler name if requested
174 if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler_name(comp_level()));
175 print(tty);
176 }
177
178 // ------------------------------------------------------------------
179 // CompileTask::print_impl
180 void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
181 bool is_osr_method, int osr_bci, bool is_blocking,
182 const char* msg, bool short_form, bool cr) {
183 if (!short_form) {
184 st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp
185 }
186 st->print("%4d ", compile_id); // print compilation number
187
188 // For unloaded methods the transition to zombie occurs after the
189 // method is cleared so it's impossible to report accurate
190 // information for that case.
191 bool is_synchronized = false;
192 bool has_exception_handler = false;
193 bool is_native = false;
194 if (method != NULL) {
195 is_synchronized = method->is_synchronized();
196 has_exception_handler = method->has_exception_handler();
197 is_native = method->is_native();
198 }
199 // method attributes
200 const char compile_type = is_osr_method ? '%' : ' ';
201 const char sync_char = is_synchronized ? 's' : ' ';
202 const char exception_char = has_exception_handler ? '!' : ' ';
203 const char blocking_char = is_blocking ? 'b' : ' ';
204 const char native_char = is_native ? 'n' : ' ';
205
254 bool is_osr_method = osr_bci() != InvocationEntryBci;
255 print_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form, cr);
256 }
257
258 // ------------------------------------------------------------------
259 // CompileTask::log_task
260 void CompileTask::log_task(xmlStream* log) {
261 Thread* thread = Thread::current();
262 methodHandle method(thread, this->method());
263 ResourceMark rm(thread);
264
265 // <task id='9' method='M' osr_bci='X' level='1' blocking='1' stamp='1.234'>
266 log->print(" compile_id='%d'", _compile_id);
267 if (_osr_bci != CompileBroker::standard_entry_bci) {
268 log->print(" compile_kind='osr'"); // same as nmethod::compile_kind
269 } // else compile_kind='c2c'
270 if (!method.is_null()) log->method(method);
271 if (_osr_bci != CompileBroker::standard_entry_bci) {
272 log->print(" osr_bci='%d'", _osr_bci);
273 }
274 if (_comp_level != CompLevel_highest_tier) {
275 log->print(" level='%d'", _comp_level);
276 }
277 if (_is_blocking) {
278 log->print(" blocking='1'");
279 }
280 log->stamp();
281 }
282
283 // ------------------------------------------------------------------
284 // CompileTask::log_task_queued
285 void CompileTask::log_task_queued() {
286 Thread* thread = Thread::current();
287 ttyLocker ttyl;
288 ResourceMark rm(thread);
289
290 xtty->begin_elem("task_queued");
291 log_task(xtty);
292 if (_comment != NULL) {
293 xtty->print(" comment='%s'", _comment);
294 }
295 if (_hot_method != NULL) {
296 methodHandle hot(thread, _hot_method);
297 methodHandle method(thread, _method);
298 if (hot() != method()) {
299 xtty->method(hot);
300 }
301 }
302 if (_hot_count != 0) {
303 xtty->print(" hot_count='%d'", _hot_count);
304 }
305 xtty->end_elem();
306 }
307
308
309 // ------------------------------------------------------------------
310 // CompileTask::log_task_start
311 void CompileTask::log_task_start(CompileLog* log) {
312 log->begin_head("task");
313 log_task(log);
314 log->end_head();
315 }
316
317
318 // ------------------------------------------------------------------
319 // CompileTask::log_task_done
320 void CompileTask::log_task_done(CompileLog* log) {
321 Thread* thread = Thread::current();
322 methodHandle method(thread, this->method());
323 ResourceMark rm(thread);
324
325 if (!_is_success) {
326 const char* reason = _failure_reason != NULL ? _failure_reason : "unknown";
327 log->elem("failure reason='%s'", reason);
328 }
329
|
166 print(st);
167 }
168
169 // ------------------------------------------------------------------
170 // CompileTask::print_tty
171 void CompileTask::print_tty() {
172 ttyLocker ttyl; // keep the following output all in one block
173 // print compiler name if requested
174 if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler_name(comp_level()));
175 print(tty);
176 }
177
178 // ------------------------------------------------------------------
179 // CompileTask::print_impl
180 void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
181 bool is_osr_method, int osr_bci, bool is_blocking,
182 const char* msg, bool short_form, bool cr) {
183 if (!short_form) {
184 st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp
185 }
186 // print compiler name if requested
187 if (CIPrintCompilerName) {
188 st->print("%s:", CompileBroker::compiler_name(comp_level));
189 }
190 st->print("%4d ", compile_id); // print compilation number
191
192 // For unloaded methods the transition to zombie occurs after the
193 // method is cleared so it's impossible to report accurate
194 // information for that case.
195 bool is_synchronized = false;
196 bool has_exception_handler = false;
197 bool is_native = false;
198 if (method != NULL) {
199 is_synchronized = method->is_synchronized();
200 has_exception_handler = method->has_exception_handler();
201 is_native = method->is_native();
202 }
203 // method attributes
204 const char compile_type = is_osr_method ? '%' : ' ';
205 const char sync_char = is_synchronized ? 's' : ' ';
206 const char exception_char = has_exception_handler ? '!' : ' ';
207 const char blocking_char = is_blocking ? 'b' : ' ';
208 const char native_char = is_native ? 'n' : ' ';
209
258 bool is_osr_method = osr_bci() != InvocationEntryBci;
259 print_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form, cr);
260 }
261
262 // ------------------------------------------------------------------
263 // CompileTask::log_task
264 void CompileTask::log_task(xmlStream* log) {
265 Thread* thread = Thread::current();
266 methodHandle method(thread, this->method());
267 ResourceMark rm(thread);
268
269 // <task id='9' method='M' osr_bci='X' level='1' blocking='1' stamp='1.234'>
270 log->print(" compile_id='%d'", _compile_id);
271 if (_osr_bci != CompileBroker::standard_entry_bci) {
272 log->print(" compile_kind='osr'"); // same as nmethod::compile_kind
273 } // else compile_kind='c2c'
274 if (!method.is_null()) log->method(method);
275 if (_osr_bci != CompileBroker::standard_entry_bci) {
276 log->print(" osr_bci='%d'", _osr_bci);
277 }
278 // Always print the level in tiered.
279 if (_comp_level != CompLevel_highest_tier || TieredCompilation) {
280 log->print(" level='%d'", _comp_level);
281 }
282 if (_is_blocking) {
283 log->print(" blocking='1'");
284 }
285 log->stamp();
286 }
287
288 // ------------------------------------------------------------------
289 // CompileTask::log_task_queued
290 void CompileTask::log_task_queued() {
291 Thread* thread = Thread::current();
292 ttyLocker ttyl;
293 ResourceMark rm(thread);
294
295 xtty->begin_elem("task_queued");
296 log_task(xtty);
297 if (_comment != NULL) {
298 xtty->print(" comment='%s'", _comment);
299 }
300 if (_hot_method != NULL) {
301 methodHandle hot(thread, _hot_method);
302 methodHandle method(thread, _method);
303 if (hot() != method()) {
304 xtty->method(hot);
305 }
306 }
307 if (_hot_count != 0) {
308 xtty->print(" hot_count='%d'", _hot_count);
309 }
310 xtty->end_elem();
311 }
312
313
314 // ------------------------------------------------------------------
315 // CompileTask::log_task_dequeued
316 void CompileTask::log_task_dequeued(const char* comment) {
317 if (LogCompilation && xtty != NULL) {
318 Thread* thread = Thread::current();
319 ttyLocker ttyl;
320 ResourceMark rm(thread);
321
322 xtty->begin_elem("task_dequeued");
323 log_task(xtty);
324 if (comment != NULL) {
325 xtty->print(" comment='%s'", comment);
326 }
327 xtty->end_elem();
328 }
329 }
330
331
332 // ------------------------------------------------------------------
333 // CompileTask::log_task_start
334 void CompileTask::log_task_start(CompileLog* log) {
335 log->begin_head("task");
336 log_task(log);
337 log->end_head();
338 }
339
340
341 // ------------------------------------------------------------------
342 // CompileTask::log_task_done
343 void CompileTask::log_task_done(CompileLog* log) {
344 Thread* thread = Thread::current();
345 methodHandle method(thread, this->method());
346 ResourceMark rm(thread);
347
348 if (!_is_success) {
349 const char* reason = _failure_reason != NULL ? _failure_reason : "unknown";
350 log->elem("failure reason='%s'", reason);
351 }
352
|