< prev index next >
src/share/vm/oops/klass.cpp
Print this page
@@ -29,10 +29,12 @@
#include "classfile/vmSymbols.hpp"
#include "gc/shared/collectedHeap.inline.hpp"
#include "logging/log.hpp"
#include "memory/heapInspection.hpp"
#include "memory/metadataFactory.hpp"
+#include "memory/metaspaceClosure.hpp"
+#include "memory/metaspaceShared.hpp"
#include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/klass.inline.hpp"
#include "oops/oop.inline.hpp"
@@ -160,12 +162,11 @@
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, /*read_only*/false,
- MetaspaceObj::ClassType, THREAD);
+ return Metaspace::allocate(loader_data, word_size, MetaspaceObj::ClassType, THREAD);
}
// "Normal" instantiation is preceeded by a MetaspaceObj allocation
// which zeros out memory - calloc equivalent.
// The constructor is also used from CppVtableCloner,
@@ -483,10 +484,33 @@
void Klass::oops_do(OopClosure* cl) {
cl->do_oop(&_java_mirror);
}
+void Klass::metaspace_pointers_do(MetaspaceClosure* it) {
+ if (log_is_enabled(Trace, cds)) {
+ ResourceMark rm;
+ log_trace(cds)("Iter(Klass): %p (%s)", this, external_name());
+ }
+
+ it->push(&_name);
+ it->push(&_secondary_super_cache);
+ it->push(&_secondary_supers);
+ for (int i = 0; i < _primary_super_limit; i++) {
+ it->push(&_primary_supers[i]);
+ }
+ it->push(&_super);
+ it->push(&_subklass);
+ it->push(&_next_sibling);
+ it->push(&_next_link);
+
+ vtableEntry* vt = start_of_vtable();
+ for (int i=0; i<vtable_length(); i++) {
+ it->push(vt[i].method_addr());
+ }
+}
+
void Klass::remove_unshareable_info() {
assert (DumpSharedSpaces, "only called for DumpSharedSpaces");
TRACE_REMOVE_ID(this);
set_subklass(NULL);
< prev index next >