< 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) {

1331     st->print("  - "); st->print("%d elements;", _secondary_supers->length());
1332     st->print_cr(" bitmap: " UINTX_FORMAT_X_0, _secondary_supers_bitmap);
1333     if (_secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_EMPTY &&
1334         _secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_FULL) {
1335       st->print("  - "); print_positive_lookup_stats(secondary_supers(),
1336                                                      _secondary_supers_bitmap, st); st->cr();
1337       st->print("  - "); print_negative_lookup_stats(_secondary_supers_bitmap, st); st->cr();
1338     }
1339   } else {
1340     st->print("null");
1341   }
1342 }
1343 
1344 void Klass::on_secondary_supers_verification_failure(Klass* super, Klass* sub, bool linear_result, bool table_result, const char* msg) {
1345   ResourceMark rm;
1346   super->print();
1347   sub->print();
1348   fatal("%s: %s implements %s: linear_search: %d; table_lookup: %d",
1349         msg, sub->external_name(), super->external_name(), linear_result, table_result);
1350 }














  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) {

1332     st->print("  - "); st->print("%d elements;", _secondary_supers->length());
1333     st->print_cr(" bitmap: " UINTX_FORMAT_X_0, _secondary_supers_bitmap);
1334     if (_secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_EMPTY &&
1335         _secondary_supers_bitmap != SECONDARY_SUPERS_BITMAP_FULL) {
1336       st->print("  - "); print_positive_lookup_stats(secondary_supers(),
1337                                                      _secondary_supers_bitmap, st); st->cr();
1338       st->print("  - "); print_negative_lookup_stats(_secondary_supers_bitmap, st); st->cr();
1339     }
1340   } else {
1341     st->print("null");
1342   }
1343 }
1344 
1345 void Klass::on_secondary_supers_verification_failure(Klass* super, Klass* sub, bool linear_result, bool table_result, const char* msg) {
1346   ResourceMark rm;
1347   super->print();
1348   sub->print();
1349   fatal("%s: %s implements %s: linear_search: %d; table_lookup: %d",
1350         msg, sub->external_name(), super->external_name(), linear_result, table_result);
1351 }
1352 
1353 static int expanded = 0;
1354 static int not_expanded = 0;
1355 static NumberSeq seq = NumberSeq();
1356 
1357 bool Klass::expand_for_hash(oop obj, markWord m) const {
1358   assert(UseCompactObjectHeaders, "only with compact i-hash");
1359   {
1360     ResourceMark rm;
1361     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());
1362   }
1363   return obj->base_size_given_klass(m, this) * HeapWordSize - hash_offset_in_bytes(obj, m) < (int)sizeof(uint32_t);
1364 }
< prev index next >