hotspot/src/share/vm/oops/klass.cpp
changeset 46746 ea379ebb9447
parent 46413 b0f67ec8f6be
child 46773 fb17cc9a6847
--- a/hotspot/src/share/vm/oops/klass.cpp	Sat Jul 22 15:54:27 2017 -0400
+++ b/hotspot/src/share/vm/oops/klass.cpp	Wed Aug 02 18:06:38 2017 -0700
@@ -31,6 +31,8 @@
 #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"
@@ -162,8 +164,7 @@
 }
 
 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
@@ -485,6 +486,29 @@
   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);