< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page

  37 #include "gc/shared/collectedHeap.inline.hpp"
  38 #include "jvm_io.h"
  39 #include "logging/log.hpp"
  40 #include "memory/metadataFactory.hpp"
  41 #include "memory/metaspaceClosure.hpp"
  42 #include "memory/oopFactory.hpp"
  43 #include "memory/resourceArea.hpp"
  44 #include "memory/universe.hpp"
  45 #include "oops/compressedKlass.inline.hpp"
  46 #include "oops/compressedOops.inline.hpp"
  47 #include "oops/instanceKlass.hpp"
  48 #include "oops/klass.inline.hpp"
  49 #include "oops/objArrayKlass.hpp"
  50 #include "oops/oop.inline.hpp"
  51 #include "oops/oopHandle.inline.hpp"
  52 #include "prims/jvmtiExport.hpp"
  53 #include "runtime/atomic.hpp"
  54 #include "runtime/handles.inline.hpp"
  55 #include "runtime/perfData.hpp"
  56 #include "utilities/macros.hpp"

  57 #include "utilities/powerOfTwo.hpp"
  58 #include "utilities/rotate_bits.hpp"
  59 #include "utilities/stack.inline.hpp"
  60 
  61 void Klass::set_java_mirror(Handle m) {
  62   assert(!m.is_null(), "New mirror should never be null.");
  63   assert(_java_mirror.is_empty(), "should only be used to initialize mirror");
  64   _java_mirror = class_loader_data()->add_handle(m);
  65 }
  66 
  67 bool Klass::is_cloneable() const {
  68   return _misc_flags.is_cloneable_fast() ||
  69          is_subtype_of(vmClasses::Cloneable_klass());
  70 }
  71 
  72 void Klass::set_is_cloneable() {
  73   if (name() == vmSymbols::java_lang_invoke_MemberName()) {
  74     assert(is_final(), "no subclasses allowed");
  75     // MemberName cloning should not be intrinsified and always happen in JVM_Clone.
  76   } else if (is_instance_klass() && InstanceKlass::cast(this)->reference_type() != REF_NONE) {

1319     st->print("  - "); st->print("%d elements;", _secondary_supers->length());
1320     st->print_cr(" bitmap: " UINTX_FORMAT_X_0, _secondary_supers_bitmap);
1321     if (_secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_EMPTY &&
1322         _secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_FULL) {
1323       st->print("  - "); print_positive_lookup_stats(secondary_supers(),
1324                                                      _secondary_supers_bitmap, st); st->cr();
1325       st->print("  - "); print_negative_lookup_stats(_secondary_supers_bitmap, st); st->cr();
1326     }
1327   } else {
1328     st->print("null");
1329   }
1330 }
1331 
1332 void Klass::on_secondary_supers_verification_failure(Klass* super, Klass* sub, bool linear_result, bool table_result, const char* msg) {
1333   ResourceMark rm;
1334   super->print();
1335   sub->print();
1336   fatal("%s: %s implements %s: linear_search: %d; table_lookup: %d",
1337         msg, sub->external_name(), super->external_name(), linear_result, table_result);
1338 }














  37 #include "gc/shared/collectedHeap.inline.hpp"
  38 #include "jvm_io.h"
  39 #include "logging/log.hpp"
  40 #include "memory/metadataFactory.hpp"
  41 #include "memory/metaspaceClosure.hpp"
  42 #include "memory/oopFactory.hpp"
  43 #include "memory/resourceArea.hpp"
  44 #include "memory/universe.hpp"
  45 #include "oops/compressedKlass.inline.hpp"
  46 #include "oops/compressedOops.inline.hpp"
  47 #include "oops/instanceKlass.hpp"
  48 #include "oops/klass.inline.hpp"
  49 #include "oops/objArrayKlass.hpp"
  50 #include "oops/oop.inline.hpp"
  51 #include "oops/oopHandle.inline.hpp"
  52 #include "prims/jvmtiExport.hpp"
  53 #include "runtime/atomic.hpp"
  54 #include "runtime/handles.inline.hpp"
  55 #include "runtime/perfData.hpp"
  56 #include "utilities/macros.hpp"
  57 #include "utilities/numberSeq.hpp"
  58 #include "utilities/powerOfTwo.hpp"
  59 #include "utilities/rotate_bits.hpp"
  60 #include "utilities/stack.inline.hpp"
  61 
  62 void Klass::set_java_mirror(Handle m) {
  63   assert(!m.is_null(), "New mirror should never be null.");
  64   assert(_java_mirror.is_empty(), "should only be used to initialize mirror");
  65   _java_mirror = class_loader_data()->add_handle(m);
  66 }
  67 
  68 bool Klass::is_cloneable() const {
  69   return _misc_flags.is_cloneable_fast() ||
  70          is_subtype_of(vmClasses::Cloneable_klass());
  71 }
  72 
  73 void Klass::set_is_cloneable() {
  74   if (name() == vmSymbols::java_lang_invoke_MemberName()) {
  75     assert(is_final(), "no subclasses allowed");
  76     // MemberName cloning should not be intrinsified and always happen in JVM_Clone.
  77   } else if (is_instance_klass() && InstanceKlass::cast(this)->reference_type() != REF_NONE) {

1320     st->print("  - "); st->print("%d elements;", _secondary_supers->length());
1321     st->print_cr(" bitmap: " UINTX_FORMAT_X_0, _secondary_supers_bitmap);
1322     if (_secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_EMPTY &&
1323         _secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_FULL) {
1324       st->print("  - "); print_positive_lookup_stats(secondary_supers(),
1325                                                      _secondary_supers_bitmap, st); st->cr();
1326       st->print("  - "); print_negative_lookup_stats(_secondary_supers_bitmap, st); st->cr();
1327     }
1328   } else {
1329     st->print("null");
1330   }
1331 }
1332 
1333 void Klass::on_secondary_supers_verification_failure(Klass* super, Klass* sub, bool linear_result, bool table_result, const char* msg) {
1334   ResourceMark rm;
1335   super->print();
1336   sub->print();
1337   fatal("%s: %s implements %s: linear_search: %d; table_lookup: %d",
1338         msg, sub->external_name(), super->external_name(), linear_result, table_result);
1339 }
1340 
1341 static int expanded = 0;
1342 static int not_expanded = 0;
1343 static NumberSeq seq = NumberSeq();
1344 
1345 bool Klass::expand_for_hash(oop obj, markWord m) const {
1346   assert(UseCompactObjectHeaders, "only with compact i-hash");
1347   {
1348     ResourceMark rm;
1349     assert((size_t)hash_offset_in_bytes(obj,m ) <= (obj->base_size_given_klass(m, this) * HeapWordSize), "hash offset must be eq or lt base size: hash offset: %d, base size: %zu, class-name: %s", hash_offset_in_bytes(obj, m), obj->base_size_given_klass(m, this) * HeapWordSize, external_name());
1350   }
1351   return obj->base_size_given_klass(m, this) * HeapWordSize - hash_offset_in_bytes(obj, m) < (int)sizeof(uint32_t);
1352 }
< prev index next >