< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page




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


 724 
 725 // Printing
 726 
 727 void Klass::print_on(outputStream* st) const {
 728   ResourceMark rm;
 729   // print title
 730   st->print("%s", internal_name());
 731   print_address_on(st);
 732   st->cr();
 733 }
 734 
 735 void Klass::oop_print_on(oop obj, outputStream* st) {
 736   ResourceMark rm;
 737   // print title
 738   st->print_cr("%s ", internal_name());
 739   obj->print_address_on(st);
 740 
 741   if (WizardMode) {
 742      // print header
 743      obj->mark()->print_on(st);










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




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


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


< prev index next >