< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page

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

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

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














  36 #include "gc/shared/collectedHeap.inline.hpp"
  37 #include "jvm_io.h"
  38 #include "logging/log.hpp"
  39 #include "memory/metadataFactory.hpp"
  40 #include "memory/metaspaceClosure.hpp"
  41 #include "memory/oopFactory.hpp"
  42 #include "memory/resourceArea.hpp"
  43 #include "memory/universe.hpp"
  44 #include "oops/compressedKlass.inline.hpp"
  45 #include "oops/compressedOops.inline.hpp"
  46 #include "oops/instanceKlass.hpp"
  47 #include "oops/klass.inline.hpp"
  48 #include "oops/objArrayKlass.hpp"
  49 #include "oops/oop.inline.hpp"
  50 #include "oops/oopHandle.inline.hpp"
  51 #include "prims/jvmtiExport.hpp"
  52 #include "runtime/atomicAccess.hpp"
  53 #include "runtime/handles.inline.hpp"
  54 #include "runtime/perfData.hpp"
  55 #include "utilities/macros.hpp"
  56 #include "utilities/numberSeq.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) {

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