< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page
*** 48,11 ***
--- 48,13 ---
  #include "oops/oop.inline.hpp"
  #include "oops/oopHandle.inline.hpp"
  #include "prims/jvmtiExport.hpp"
  #include "runtime/arguments.hpp"
  #include "runtime/atomic.hpp"
+ #include "runtime/globals.hpp"
  #include "runtime/handles.inline.hpp"
+ #include "utilities/align.hpp"
  #include "utilities/macros.hpp"
  #include "utilities/powerOfTwo.hpp"
  #include "utilities/stack.inline.hpp"
  
  void Klass::set_java_mirror(Handle m) {

*** 194,18 ***
    ShouldNotReachHere();
    return NULL;
  }
  
  void* Klass::operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw() {
!   return Metaspace::allocate(loader_data, word_size, MetaspaceObj::ClassType, THREAD);
  }
  
  // "Normal" instantiation is preceded by a MetaspaceObj allocation
  // which zeros out memory - calloc equivalent.
  // The constructor is also used from CppVtableCloner,
  // which doesn't zero out the memory before calling the constructor.
  Klass::Klass(KlassKind kind) : _kind(kind),
                             _shared_class_path_index(-1) {
    CDS_ONLY(_shared_class_flags = 0;)
    CDS_JAVA_HEAP_ONLY(_archived_mirror_index = -1;)
    _primary_supers[0] = this;
    set_super_check_offset(in_bytes(primary_supers_offset()));
--- 196,21 ---
    ShouldNotReachHere();
    return NULL;
  }
  
  void* Klass::operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw() {
!   MetaWord* p = Metaspace::allocate(loader_data, word_size, MetaspaceObj::ClassType, THREAD);
+   assert(is_aligned(p, KlassAlignmentInBytes), "metaspace returned badly aligned memory.");
+   return p;
  }
  
  // "Normal" instantiation is preceded by a MetaspaceObj allocation
  // which zeros out memory - calloc equivalent.
  // The constructor is also used from CppVtableCloner,
  // which doesn't zero out the memory before calling the constructor.
  Klass::Klass(KlassKind kind) : _kind(kind),
+                            _prototype_header(markWord::prototype() LP64_ONLY(.set_klass(this))),
                             _shared_class_path_index(-1) {
    CDS_ONLY(_shared_class_flags = 0;)
    CDS_JAVA_HEAP_ONLY(_archived_mirror_index = -1;)
    _primary_supers[0] = this;
    set_super_check_offset(in_bytes(primary_supers_offset()));

*** 746,10 ***
--- 751,12 ---
  
    if (WizardMode) {
       // print header
       obj->mark().print_on(st);
       st->cr();
+      st->print(BULLET"prototype_header: " INTPTR_FORMAT, _prototype_header.value());
+      st->cr();
    }
  
    // print class
    st->print(BULLET"klass: ");
    obj->klass()->print_value_on(st);

*** 769,10 ***
--- 776,14 ---
  
    // This can be expensive, but it is worth checking that this klass is actually
    // in the CLD graph but not in production.
    assert(Metaspace::contains((address)this), "Should be");
  
+   if (UseCompressedClassPointers) {
+     assert(is_aligned(this, KlassAlignmentInBytes), "misaligned Klass structure");
+   }
+ 
    guarantee(this->is_klass(),"should be klass");
  
    if (super() != NULL) {
      guarantee(super()->is_klass(), "should be klass");
    }
< prev index next >