Mercurial > hg > truffle
comparison src/share/vm/oops/instanceKlassKlass.cpp @ 676:d3676b4cb78c
Merge
author | kvn |
---|---|
date | Tue, 31 Mar 2009 10:02:01 -0700 |
parents | c89f86385056 |
children | be93aad57795 |
comparison
equal
deleted
inserted
replaced
662:9ab385cb0c42 | 676:d3676b4cb78c |
---|---|
1 /* | 1 /* |
2 * Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
485 | 485 |
486 #ifndef PRODUCT | 486 #ifndef PRODUCT |
487 | 487 |
488 // Printing | 488 // Printing |
489 | 489 |
490 #define BULLET " - " | |
491 | |
490 static const char* state_names[] = { | 492 static const char* state_names[] = { |
491 "unparseable_by_gc", "allocated", "loaded", "linked", "being_initialized", "fully_initialized", "initialization_error" | 493 "unparseable_by_gc", "allocated", "loaded", "linked", "being_initialized", "fully_initialized", "initialization_error" |
492 }; | 494 }; |
493 | 495 |
494 | 496 |
495 void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) { | 497 void instanceKlassKlass::oop_print_on(oop obj, outputStream* st) { |
496 assert(obj->is_klass(), "must be klass"); | 498 assert(obj->is_klass(), "must be klass"); |
497 instanceKlass* ik = instanceKlass::cast(klassOop(obj)); | 499 instanceKlass* ik = instanceKlass::cast(klassOop(obj)); |
498 klassKlass::oop_print_on(obj, st); | 500 klassKlass::oop_print_on(obj, st); |
499 | 501 |
500 st->print(" - instance size: %d", ik->size_helper()); st->cr(); | 502 st->print(BULLET"instance size: %d", ik->size_helper()); st->cr(); |
501 st->print(" - klass size: %d", ik->object_size()); st->cr(); | 503 st->print(BULLET"klass size: %d", ik->object_size()); st->cr(); |
502 st->print(" - access: "); ik->access_flags().print_on(st); st->cr(); | 504 st->print(BULLET"access: "); ik->access_flags().print_on(st); st->cr(); |
503 st->print(" - state: "); st->print_cr(state_names[ik->_init_state]); | 505 st->print(BULLET"state: "); st->print_cr(state_names[ik->_init_state]); |
504 st->print(" - name: "); ik->name()->print_value_on(st); st->cr(); | 506 st->print(BULLET"name: "); ik->name()->print_value_on(st); st->cr(); |
505 st->print(" - super: "); ik->super()->print_value_on(st); st->cr(); | 507 st->print(BULLET"super: "); ik->super()->print_value_on(st); st->cr(); |
506 st->print(" - sub: "); | 508 st->print(BULLET"sub: "); |
507 Klass* sub = ik->subklass(); | 509 Klass* sub = ik->subklass(); |
508 int n; | 510 int n; |
509 for (n = 0; sub != NULL; n++, sub = sub->next_sibling()) { | 511 for (n = 0; sub != NULL; n++, sub = sub->next_sibling()) { |
510 if (n < MaxSubklassPrintSize) { | 512 if (n < MaxSubklassPrintSize) { |
511 sub->as_klassOop()->print_value_on(st); | 513 sub->as_klassOop()->print_value_on(st); |
514 } | 516 } |
515 if (n >= MaxSubklassPrintSize) st->print("(%d more klasses...)", n - MaxSubklassPrintSize); | 517 if (n >= MaxSubklassPrintSize) st->print("(%d more klasses...)", n - MaxSubklassPrintSize); |
516 st->cr(); | 518 st->cr(); |
517 | 519 |
518 if (ik->is_interface()) { | 520 if (ik->is_interface()) { |
519 st->print_cr(" - nof implementors: %d", ik->nof_implementors()); | 521 st->print_cr(BULLET"nof implementors: %d", ik->nof_implementors()); |
520 int print_impl = 0; | 522 int print_impl = 0; |
521 for (int i = 0; i < instanceKlass::implementors_limit; i++) { | 523 for (int i = 0; i < instanceKlass::implementors_limit; i++) { |
522 if (ik->implementor(i) != NULL) { | 524 if (ik->implementor(i) != NULL) { |
523 if (++print_impl == 1) | 525 if (++print_impl == 1) |
524 st->print_cr(" - implementor: "); | 526 st->print_cr(BULLET"implementor: "); |
525 st->print(" "); | 527 st->print(" "); |
526 ik->implementor(i)->print_value_on(st); | 528 ik->implementor(i)->print_value_on(st); |
527 } | 529 } |
528 } | 530 } |
529 if (print_impl > 0) st->cr(); | 531 if (print_impl > 0) st->cr(); |
530 } | 532 } |
531 | 533 |
532 st->print(" - arrays: "); ik->array_klasses()->print_value_on(st); st->cr(); | 534 st->print(BULLET"arrays: "); ik->array_klasses()->print_value_on(st); st->cr(); |
533 st->print(" - methods: "); ik->methods()->print_value_on(st); st->cr(); | 535 st->print(BULLET"methods: "); ik->methods()->print_value_on(st); st->cr(); |
534 if (Verbose) { | 536 if (Verbose) { |
535 objArrayOop methods = ik->methods(); | 537 objArrayOop methods = ik->methods(); |
536 for(int i = 0; i < methods->length(); i++) { | 538 for(int i = 0; i < methods->length(); i++) { |
537 tty->print("%d : ", i); methods->obj_at(i)->print_value(); tty->cr(); | 539 tty->print("%d : ", i); methods->obj_at(i)->print_value(); tty->cr(); |
538 } | 540 } |
539 } | 541 } |
540 st->print(" - method ordering: "); ik->method_ordering()->print_value_on(st); st->cr(); | 542 st->print(BULLET"method ordering: "); ik->method_ordering()->print_value_on(st); st->cr(); |
541 st->print(" - local interfaces: "); ik->local_interfaces()->print_value_on(st); st->cr(); | 543 st->print(BULLET"local interfaces: "); ik->local_interfaces()->print_value_on(st); st->cr(); |
542 st->print(" - trans. interfaces: "); ik->transitive_interfaces()->print_value_on(st); st->cr(); | 544 st->print(BULLET"trans. interfaces: "); ik->transitive_interfaces()->print_value_on(st); st->cr(); |
543 st->print(" - constants: "); ik->constants()->print_value_on(st); st->cr(); | 545 st->print(BULLET"constants: "); ik->constants()->print_value_on(st); st->cr(); |
544 st->print(" - class loader: "); ik->class_loader()->print_value_on(st); st->cr(); | 546 st->print(BULLET"class loader: "); ik->class_loader()->print_value_on(st); st->cr(); |
545 st->print(" - protection domain: "); ik->protection_domain()->print_value_on(st); st->cr(); | 547 st->print(BULLET"protection domain: "); ik->protection_domain()->print_value_on(st); st->cr(); |
546 st->print(" - host class: "); ik->host_klass()->print_value_on(st); st->cr(); | 548 st->print(BULLET"host class: "); ik->host_klass()->print_value_on(st); st->cr(); |
547 st->print(" - signers: "); ik->signers()->print_value_on(st); st->cr(); | 549 st->print(BULLET"signers: "); ik->signers()->print_value_on(st); st->cr(); |
548 if (ik->source_file_name() != NULL) { | 550 if (ik->source_file_name() != NULL) { |
549 st->print(" - source file: "); | 551 st->print(BULLET"source file: "); |
550 ik->source_file_name()->print_value_on(st); | 552 ik->source_file_name()->print_value_on(st); |
551 st->cr(); | 553 st->cr(); |
552 } | 554 } |
553 if (ik->source_debug_extension() != NULL) { | 555 if (ik->source_debug_extension() != NULL) { |
554 st->print(" - source debug extension: "); | 556 st->print(BULLET"source debug extension: "); |
555 ik->source_debug_extension()->print_value_on(st); | 557 ik->source_debug_extension()->print_value_on(st); |
556 st->cr(); | 558 st->cr(); |
557 } | 559 } |
558 | 560 |
559 st->print_cr(" - previous version: "); | |
560 { | 561 { |
561 ResourceMark rm; | 562 ResourceMark rm; |
562 // PreviousVersionInfo objects returned via PreviousVersionWalker | 563 // PreviousVersionInfo objects returned via PreviousVersionWalker |
563 // contain a GrowableArray of handles. We have to clean up the | 564 // contain a GrowableArray of handles. We have to clean up the |
564 // GrowableArray _after_ the PreviousVersionWalker destructor | 565 // GrowableArray _after_ the PreviousVersionWalker destructor |
565 // has destroyed the handles. | 566 // has destroyed the handles. |
566 { | 567 { |
568 bool have_pv = false; | |
567 PreviousVersionWalker pvw(ik); | 569 PreviousVersionWalker pvw(ik); |
568 for (PreviousVersionInfo * pv_info = pvw.next_previous_version(); | 570 for (PreviousVersionInfo * pv_info = pvw.next_previous_version(); |
569 pv_info != NULL; pv_info = pvw.next_previous_version()) { | 571 pv_info != NULL; pv_info = pvw.next_previous_version()) { |
572 if (!have_pv) | |
573 st->print(BULLET"previous version: "); | |
574 have_pv = true; | |
570 pv_info->prev_constant_pool_handle()()->print_value_on(st); | 575 pv_info->prev_constant_pool_handle()()->print_value_on(st); |
571 } | 576 } |
572 st->cr(); | 577 if (have_pv) st->cr(); |
573 } // pvw is cleaned up | 578 } // pvw is cleaned up |
574 } // rm is cleaned up | 579 } // rm is cleaned up |
575 | 580 |
576 if (ik->generic_signature() != NULL) { | 581 if (ik->generic_signature() != NULL) { |
577 st->print(" - generic signature: "); | 582 st->print(BULLET"generic signature: "); |
578 ik->generic_signature()->print_value_on(st); | 583 ik->generic_signature()->print_value_on(st); |
579 } | 584 st->cr(); |
580 st->print(" - inner classes: "); ik->inner_classes()->print_value_on(st); st->cr(); | 585 } |
581 st->print(" - java mirror: "); ik->java_mirror()->print_value_on(st); st->cr(); | 586 st->print(BULLET"inner classes: "); ik->inner_classes()->print_value_on(st); st->cr(); |
582 st->print(" - vtable length %d (start addr: " INTPTR_FORMAT ")", ik->vtable_length(), ik->start_of_vtable()); st->cr(); | 587 st->print(BULLET"java mirror: "); ik->java_mirror()->print_value_on(st); st->cr(); |
583 st->print(" - itable length %d (start addr: " INTPTR_FORMAT ")", ik->itable_length(), ik->start_of_itable()); st->cr(); | 588 st->print(BULLET"vtable length %d (start addr: " INTPTR_FORMAT ")", ik->vtable_length(), ik->start_of_vtable()); st->cr(); |
584 st->print_cr(" - static fields:"); | 589 st->print(BULLET"itable length %d (start addr: " INTPTR_FORMAT ")", ik->itable_length(), ik->start_of_itable()); st->cr(); |
590 st->print_cr(BULLET"---- static fields (%d words):", ik->static_field_size()); | |
585 FieldPrinter print_static_field(st); | 591 FieldPrinter print_static_field(st); |
586 ik->do_local_static_fields(&print_static_field); | 592 ik->do_local_static_fields(&print_static_field); |
587 st->print_cr(" - non-static fields:"); | 593 st->print_cr(BULLET"---- non-static fields (%d words):", ik->nonstatic_field_size()); |
588 FieldPrinter print_nonstatic_field(st, obj); | 594 FieldPrinter print_nonstatic_field(st); |
589 ik->do_nonstatic_fields(&print_nonstatic_field); | 595 ik->do_nonstatic_fields(&print_nonstatic_field); |
590 | 596 |
591 st->print(" - static oop maps: "); | 597 st->print(BULLET"static oop maps: "); |
592 if (ik->static_oop_field_size() > 0) { | 598 if (ik->static_oop_field_size() > 0) { |
593 int first_offset = ik->offset_of_static_fields(); | 599 int first_offset = ik->offset_of_static_fields(); |
594 st->print("%d-%d", first_offset, first_offset + ik->static_oop_field_size() - 1); | 600 st->print("%d-%d", first_offset, first_offset + ik->static_oop_field_size() - 1); |
595 } | 601 } |
596 st->cr(); | 602 st->cr(); |
597 | 603 |
598 st->print(" - non-static oop maps: "); | 604 st->print(BULLET"non-static oop maps: "); |
599 OopMapBlock* map = ik->start_of_nonstatic_oop_maps(); | 605 OopMapBlock* map = ik->start_of_nonstatic_oop_maps(); |
600 OopMapBlock* end_map = map + ik->nonstatic_oop_map_size(); | 606 OopMapBlock* end_map = map + ik->nonstatic_oop_map_size(); |
601 while (map < end_map) { | 607 while (map < end_map) { |
602 st->print("%d-%d ", map->offset(), map->offset() + heapOopSize*(map->length() - 1)); | 608 st->print("%d-%d ", map->offset(), map->offset() + heapOopSize*(map->length() - 1)); |
603 map++; | 609 map++; |