< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page




 617 
 618 #if INCLUDE_CDS_JAVA_HEAP
 619 // Used at CDS dump time to access the archived mirror. No GC barrier.
 620 oop Klass::archived_java_mirror_raw() {
 621   assert(has_raw_archived_mirror(), "must have raw archived mirror");
 622   return CompressedOops::decode(_archived_mirror);
 623 }
 624 
 625 narrowOop Klass::archived_java_mirror_raw_narrow() {
 626   assert(has_raw_archived_mirror(), "must have raw archived mirror");
 627   return _archived_mirror;
 628 }
 629 
 630 // No GC barrier
 631 void Klass::set_archived_java_mirror_raw(oop m) {
 632   assert(DumpSharedSpaces, "called only during runtime");
 633   _archived_mirror = CompressedOops::encode(m);
 634 }
 635 #endif // INCLUDE_CDS_JAVA_HEAP
 636 
 637 Klass* Klass::array_klass_or_null(int rank) {
 638   EXCEPTION_MARK;
 639   // No exception can be thrown by array_klass_impl when called with or_null == true.
 640   // (In anycase, the execption mark will fail if it do so)
 641   return array_klass_impl(true, rank, THREAD);
 642 }
 643 
 644 
 645 Klass* Klass::array_klass_or_null() {
 646   EXCEPTION_MARK;
 647   // No exception can be thrown by array_klass_impl when called with or_null == true.
 648   // (In anycase, the execption mark will fail if it do so)
 649   return array_klass_impl(true, THREAD);
 650 }
 651 
 652 
 653 Klass* Klass::array_klass_impl(bool or_null, int rank, TRAPS) {
 654   fatal("array_klass should be dispatched to InstanceKlass, ObjArrayKlass or TypeArrayKlass");
 655   return NULL;
 656 }
 657 
 658 
 659 Klass* Klass::array_klass_impl(bool or_null, TRAPS) {
 660   fatal("array_klass should be dispatched to InstanceKlass, ObjArrayKlass or TypeArrayKlass");
 661   return NULL;
 662 }
 663 
 664 void Klass::check_array_allocation_length(int length, int max_length, TRAPS) {
 665   if (length > max_length) {
 666     if (!THREAD->in_retryable_allocation()) {
 667       report_java_out_of_memory("Requested array size exceeds VM limit");
 668       JvmtiExport::post_array_size_exhausted();
 669       THROW_OOP(Universe::out_of_memory_error_array_size());
 670     } else {
 671       THROW_OOP(Universe::out_of_memory_error_retry());
 672     }
 673   } else if (length < 0) {
 674     THROW_MSG(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
 675   }
 676 }
 677 
 678 oop Klass::class_loader() const { return class_loader_data()->class_loader(); }
 679 


 731   ResourceMark rm;
 732   // print title
 733   st->print("%s", internal_name());
 734   print_address_on(st);
 735   st->cr();
 736 }
 737 
 738 #define BULLET  " - "
 739 
 740 void Klass::oop_print_on(oop obj, outputStream* st) {
 741   // print title
 742   st->print_cr("%s ", internal_name());
 743   obj->print_address_on(st);
 744 
 745   if (WizardMode) {
 746      // print header
 747      obj->mark()->print_on(st);
 748      st->cr();
 749      st->print(BULLET"prototype_header: " INTPTR_FORMAT, p2i(_prototype_header));
 750      st->cr();










 751   }
 752 
 753   // print class
 754   st->print(BULLET"klass: ");
 755   obj->klass()->print_value_on(st);
 756   st->cr();
 757 }
 758 
 759 void Klass::oop_print_value_on(oop obj, outputStream* st) {
 760   // print title
 761   ResourceMark rm;              // Cannot print in debug mode without this
 762   st->print("%s", internal_name());
 763   obj->print_address_on(st);
 764 }
 765 
 766 #if INCLUDE_SERVICES
 767 // Size Statistics
 768 void Klass::collect_statistics(KlassSizeStats *sz) const {
 769   sz->_klass_bytes = sz->count(this);
 770   sz->_mirror_bytes = sz->count(java_mirror());




 617 
 618 #if INCLUDE_CDS_JAVA_HEAP
 619 // Used at CDS dump time to access the archived mirror. No GC barrier.
 620 oop Klass::archived_java_mirror_raw() {
 621   assert(has_raw_archived_mirror(), "must have raw archived mirror");
 622   return CompressedOops::decode(_archived_mirror);
 623 }
 624 
 625 narrowOop Klass::archived_java_mirror_raw_narrow() {
 626   assert(has_raw_archived_mirror(), "must have raw archived mirror");
 627   return _archived_mirror;
 628 }
 629 
 630 // No GC barrier
 631 void Klass::set_archived_java_mirror_raw(oop m) {
 632   assert(DumpSharedSpaces, "called only during runtime");
 633   _archived_mirror = CompressedOops::encode(m);
 634 }
 635 #endif // INCLUDE_CDS_JAVA_HEAP
 636 
 637 Klass* Klass::array_klass_or_null(ArrayStorageProperties storage_props, int rank) {
 638   EXCEPTION_MARK;
 639   // No exception can be thrown by array_klass_impl when called with or_null == true.
 640   // (In anycase, the execption mark will fail if it do so)
 641   return array_klass_impl(storage_props, true, rank, THREAD);
 642 }
 643 
 644 
 645 Klass* Klass::array_klass_or_null(ArrayStorageProperties storage_props) {
 646   EXCEPTION_MARK;
 647   // No exception can be thrown by array_klass_impl when called with or_null == true.
 648   // (In anycase, the execption mark will fail if it do so)
 649   return array_klass_impl(storage_props, true, THREAD);
 650 }
 651 
 652 
 653 Klass* Klass::array_klass_impl(ArrayStorageProperties storage_props, bool or_null, int rank, TRAPS) {
 654   fatal("array_klass should be dispatched to InstanceKlass, ObjArrayKlass or TypeArrayKlass");
 655   return NULL;
 656 }
 657 
 658 
 659 Klass* Klass::array_klass_impl(ArrayStorageProperties storage_props, bool or_null, TRAPS) {
 660   fatal("array_klass should be dispatched to InstanceKlass, ObjArrayKlass or TypeArrayKlass");
 661   return NULL;
 662 }
 663 
 664 void Klass::check_array_allocation_length(int length, int max_length, TRAPS) {
 665   if (length > max_length) {
 666     if (!THREAD->in_retryable_allocation()) {
 667       report_java_out_of_memory("Requested array size exceeds VM limit");
 668       JvmtiExport::post_array_size_exhausted();
 669       THROW_OOP(Universe::out_of_memory_error_array_size());
 670     } else {
 671       THROW_OOP(Universe::out_of_memory_error_retry());
 672     }
 673   } else if (length < 0) {
 674     THROW_MSG(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
 675   }
 676 }
 677 
 678 oop Klass::class_loader() const { return class_loader_data()->class_loader(); }
 679 


 731   ResourceMark rm;
 732   // print title
 733   st->print("%s", internal_name());
 734   print_address_on(st);
 735   st->cr();
 736 }
 737 
 738 #define BULLET  " - "
 739 
 740 void Klass::oop_print_on(oop obj, outputStream* st) {
 741   // print title
 742   st->print_cr("%s ", internal_name());
 743   obj->print_address_on(st);
 744 
 745   if (WizardMode) {
 746      // print header
 747      obj->mark()->print_on(st);
 748      st->cr();
 749      st->print(BULLET"prototype_header: " INTPTR_FORMAT, p2i(_prototype_header));
 750      st->cr();
 751      ArrayStorageProperties props = obj->array_storage_properties();
 752      if (props.value() != 0) {
 753        st->print(" - array storage properties: ");
 754        if (props.is_flattened()) {
 755          st->print(" flat");
 756        }
 757        if (props.is_null_free()) {
 758          st->print(" non nullable");
 759        }
 760      }
 761   }
 762 
 763   // print class
 764   st->print(BULLET"klass: ");
 765   obj->klass()->print_value_on(st);
 766   st->cr();
 767 }
 768 
 769 void Klass::oop_print_value_on(oop obj, outputStream* st) {
 770   // print title
 771   ResourceMark rm;              // Cannot print in debug mode without this
 772   st->print("%s", internal_name());
 773   obj->print_address_on(st);
 774 }
 775 
 776 #if INCLUDE_SERVICES
 777 // Size Statistics
 778 void Klass::collect_statistics(KlassSizeStats *sz) const {
 779   sz->_klass_bytes = sz->count(this);
 780   sz->_mirror_bytes = sz->count(java_mirror());


< prev index next >