< prev index next > src/hotspot/share/oops/klass.cpp
Print this page
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);
}
+ static markWord make_prototype(Klass* kls) {
+ markWord prototype = markWord::prototype();
+ #ifdef _LP64
+ if (UseCompactObjectHeaders) {
+ prototype = prototype.set_klass(kls);
+ }
+ #endif
+ return prototype;
+ }
+
Klass::Klass() : _kind(UnknownKlassKind) {
assert(CDSConfig::is_dumping_static_archive() || CDSConfig::is_using_archive(), "only for cds");
}
// "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(make_prototype(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()));
if (WizardMode) {
// print header
obj->mark().print_on(st);
st->cr();
+ if (UseCompactObjectHeaders) {
+ st->print(BULLET"prototype_header: " INTPTR_FORMAT, _prototype_header.value());
+ st->cr();
+ }
}
// print class
st->print(BULLET"klass: ");
obj->klass()->print_value_on(st);
< prev index next >