489 } |
489 } |
490 |
490 |
491 |
491 |
492 void Disassembler::decode(CodeBlob* cb, outputStream* st) { |
492 void Disassembler::decode(CodeBlob* cb, outputStream* st) { |
493 if (!load_library()) return; |
493 if (!load_library()) return; |
|
494 if (cb->is_nmethod()) { |
|
495 decode((nmethod*)cb, st); |
|
496 return; |
|
497 } |
494 decode_env env(cb, st); |
498 decode_env env(cb, st); |
495 env.output()->print_cr("Decoding CodeBlob " PTR_FORMAT, p2i(cb)); |
499 env.output()->print_cr("----------------------------------------------------------------------"); |
|
500 env.output()->print_cr("%s", cb->name()); |
|
501 env.output()->print_cr(" at [" PTR_FORMAT ", " PTR_FORMAT "] " JLONG_FORMAT " bytes", p2i(cb->code_begin()), p2i(cb->code_end()), ((jlong)(cb->code_end() - cb->code_begin())) * sizeof(unsigned char*)); |
496 env.decode_instructions(cb->code_begin(), cb->code_end()); |
502 env.decode_instructions(cb->code_begin(), cb->code_end()); |
497 } |
503 } |
498 |
504 |
499 void Disassembler::decode(address start, address end, outputStream* st, CodeStrings c) { |
505 void Disassembler::decode(address start, address end, outputStream* st, CodeStrings c) { |
500 if (!load_library()) return; |
506 if (!load_library()) return; |
503 } |
509 } |
504 |
510 |
505 void Disassembler::decode(nmethod* nm, outputStream* st) { |
511 void Disassembler::decode(nmethod* nm, outputStream* st) { |
506 if (!load_library()) return; |
512 if (!load_library()) return; |
507 decode_env env(nm, st); |
513 decode_env env(nm, st); |
508 env.output()->print_cr("Decoding compiled method " PTR_FORMAT ":", p2i(nm)); |
514 env.output()->print_cr("----------------------------------------------------------------------"); |
509 env.output()->print_cr("Code:"); |
|
510 |
515 |
511 #ifdef SHARK |
516 #ifdef SHARK |
512 SharkEntry* entry = (SharkEntry *) nm->code_begin(); |
517 SharkEntry* entry = (SharkEntry *) nm->code_begin(); |
513 unsigned char* p = entry->code_start(); |
518 unsigned char* p = entry->code_start(); |
514 unsigned char* end = entry->code_limit(); |
519 unsigned char* end = entry->code_limit(); |
515 #else |
520 #else |
516 unsigned char* p = nm->code_begin(); |
521 unsigned char* p = nm->code_begin(); |
517 unsigned char* end = nm->code_end(); |
522 unsigned char* end = nm->code_end(); |
518 #endif // SHARK |
523 #endif // SHARK |
|
524 |
|
525 nm->method()->method_holder()->name()->print_symbol_on(env.output()); |
|
526 env.output()->print("."); |
|
527 nm->method()->name()->print_symbol_on(env.output()); |
|
528 nm->method()->signature()->print_symbol_on(env.output()); |
|
529 #if INCLUDE_JVMCI |
|
530 { |
|
531 char buffer[O_BUFLEN]; |
|
532 char* jvmciName = nm->jvmci_installed_code_name(buffer, O_BUFLEN); |
|
533 if (jvmciName != NULL) { |
|
534 env.output()->print(" (%s)", jvmciName); |
|
535 } |
|
536 } |
|
537 #endif |
|
538 env.output()->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT "] " JLONG_FORMAT " bytes", p2i(p), p2i(end), ((jlong)(end - p))); |
519 |
539 |
520 // If there has been profiling, print the buckets. |
540 // If there has been profiling, print the buckets. |
521 if (FlatProfiler::bucket_start_for(p) != NULL) { |
541 if (FlatProfiler::bucket_start_for(p) != NULL) { |
522 unsigned char* p1 = p; |
542 unsigned char* p1 = p; |
523 int total_bucket_count = 0; |
543 int total_bucket_count = 0; |