282 // Do not grab any lock, do not allocate memory. |
277 // Do not grab any lock, do not allocate memory. |
283 // |
278 // |
284 // Otherwise it's the same as CompileTask::print_line() |
279 // Otherwise it's the same as CompileTask::print_line() |
285 // |
280 // |
286 void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) { |
281 void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) { |
287 methodOop method = (methodOop)JNIHandles::resolve(_method); |
|
288 // print compiler name |
282 // print compiler name |
289 st->print("%s:", CompileBroker::compiler(comp_level())->name()); |
283 st->print("%s:", CompileBroker::compiler(comp_level())->name()); |
290 char* method_name = NULL; |
284 print_compilation(st); |
291 if (method != NULL) { |
|
292 method_name = method->name_and_sig_as_C_string(buf, buflen); |
|
293 } |
|
294 print_compilation(st, method, method_name); |
|
295 } |
285 } |
296 |
286 |
297 // ------------------------------------------------------------------ |
287 // ------------------------------------------------------------------ |
298 // CompileTask::print_line |
288 // CompileTask::print_line |
299 void CompileTask::print_line() { |
289 void CompileTask::print_line() { |
300 Thread *thread = Thread::current(); |
|
301 methodHandle method(thread, |
|
302 (methodOop)JNIHandles::resolve(method_handle())); |
|
303 ResourceMark rm(thread); |
|
304 |
|
305 ttyLocker ttyl; // keep the following output all in one block |
290 ttyLocker ttyl; // keep the following output all in one block |
306 |
|
307 // print compiler name if requested |
291 // print compiler name if requested |
308 if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler(comp_level())->name()); |
292 if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler(comp_level())->name()); |
309 print_compilation(tty, method(), NULL); |
293 print_compilation(); |
310 } |
294 } |
311 |
295 |
|
296 |
|
297 // ------------------------------------------------------------------ |
|
298 // CompileTask::print_compilation_impl |
|
299 void CompileTask::print_compilation_impl(outputStream* st, methodOop method, int compile_id, int comp_level, bool is_osr_method, int osr_bci, bool is_blocking, const char* msg) { |
|
300 st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp |
|
301 st->print("%4d ", compile_id); // print compilation number |
|
302 |
|
303 // method attributes |
|
304 const char compile_type = is_osr_method ? '%' : ' '; |
|
305 const char sync_char = method->is_synchronized() ? 's' : ' '; |
|
306 const char exception_char = method->has_exception_handler() ? '!' : ' '; |
|
307 const char blocking_char = is_blocking ? 'b' : ' '; |
|
308 const char native_char = method->is_native() ? 'n' : ' '; |
|
309 |
|
310 // print method attributes |
|
311 st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char); |
|
312 |
|
313 if (TieredCompilation) { |
|
314 if (comp_level != -1) st->print("%d ", comp_level); |
|
315 else st->print("- "); |
|
316 } |
|
317 st->print(" "); // more indent |
|
318 |
|
319 method->print_short_name(st); |
|
320 if (is_osr_method) { |
|
321 st->print(" @ %d", osr_bci); |
|
322 } |
|
323 st->print(" (%d bytes)", method->code_size()); |
|
324 |
|
325 if (msg != NULL) { |
|
326 st->print(" %s", msg); |
|
327 } |
|
328 st->cr(); |
|
329 } |
|
330 |
|
331 // ------------------------------------------------------------------ |
|
332 // CompileTask::print_inlining |
|
333 void CompileTask::print_inlining(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg) { |
|
334 // 1234567 |
|
335 st->print(" "); // print timestamp |
|
336 // 1234 |
|
337 st->print(" "); // print compilation number |
|
338 |
|
339 // method attributes |
|
340 const char sync_char = method->is_synchronized() ? 's' : ' '; |
|
341 const char exception_char = method->has_exception_handlers() ? '!' : ' '; |
|
342 const char monitors_char = method->has_monitor_bytecodes() ? 'm' : ' '; |
|
343 |
|
344 // print method attributes |
|
345 st->print(" %c%c%c ", sync_char, exception_char, monitors_char); |
|
346 |
|
347 if (TieredCompilation) { |
|
348 st->print(" "); |
|
349 } |
|
350 st->print(" "); // more indent |
|
351 st->print(" "); // initial inlining indent |
|
352 |
|
353 for (int i = 0; i < inline_level; i++) st->print(" "); |
|
354 |
|
355 st->print("@ %d ", bci); // print bci |
|
356 method->print_short_name(st); |
|
357 st->print(" (%d bytes)", method->code_size()); |
|
358 |
|
359 if (msg != NULL) { |
|
360 st->print(" %s", msg); |
|
361 } |
|
362 st->cr(); |
|
363 } |
|
364 |
|
365 // ------------------------------------------------------------------ |
|
366 // CompileTask::print_inline_indent |
|
367 void CompileTask::print_inline_indent(int inline_level, outputStream* st) { |
|
368 // 1234567 |
|
369 st->print(" "); // print timestamp |
|
370 // 1234 |
|
371 st->print(" "); // print compilation number |
|
372 // %s!bn |
|
373 st->print(" "); // print method attributes |
|
374 if (TieredCompilation) { |
|
375 st->print(" "); |
|
376 } |
|
377 st->print(" "); // more indent |
|
378 st->print(" "); // initial inlining indent |
|
379 for (int i = 0; i < inline_level; i++) st->print(" "); |
|
380 } |
|
381 |
|
382 // ------------------------------------------------------------------ |
|
383 // CompileTask::print_compilation |
|
384 void CompileTask::print_compilation(outputStream* st) { |
|
385 oop rem = JNIHandles::resolve(method_handle()); |
|
386 assert(rem != NULL && rem->is_method(), "must be"); |
|
387 methodOop method = (methodOop) rem; |
|
388 bool is_osr_method = osr_bci() != InvocationEntryBci; |
|
389 print_compilation_impl(st, method, compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking()); |
|
390 } |
312 |
391 |
313 // ------------------------------------------------------------------ |
392 // ------------------------------------------------------------------ |
314 // CompileTask::log_task |
393 // CompileTask::log_task |
315 void CompileTask::log_task(xmlStream* log) { |
394 void CompileTask::log_task(xmlStream* log) { |
316 Thread* thread = Thread::current(); |
395 Thread* thread = Thread::current(); |