diff src/share/vm/classfile/classLoaderData.hpp @ 17935:7384f6a12fc1

8038212: Method::is_valid_method() check has performance regression impact for stackwalking Summary: Only prune metaspace virtual spaces at safepoint so walking them is safe outside a safepoint. Reviewed-by: mgerdin, mgronlun, hseigel, stefank
author coleenp
date Thu, 15 May 2014 18:23:26 -0400
parents 85318d1fe8fe
children e4a6e7f1b90b
line wrap: on
line diff
--- a/src/share/vm/classfile/classLoaderData.hpp	Thu May 15 09:25:27 2014 -0400
+++ b/src/share/vm/classfile/classLoaderData.hpp	Thu May 15 18:23:26 2014 -0400
@@ -66,6 +66,7 @@
   static ClassLoaderData* _unloading;
   // CMS support.
   static ClassLoaderData* _saved_head;
+  static bool _should_purge;
 
   static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);
   static void post_class_unload_events(void);
@@ -86,12 +87,20 @@
   static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); }
   static GrowableArray<ClassLoaderData*>* new_clds();
 
+  static void set_should_purge(bool b) { _should_purge = b; }
+  static void purge_if_needed() {
+    // Only purge the CLDG for CMS if concurrent sweep is complete.
+    if (_should_purge) {
+      purge();
+      // reset for next time.
+      set_should_purge(false);
+    }
+  }
+
   static void dump_on(outputStream * const out) PRODUCT_RETURN;
   static void dump() { dump_on(tty); }
   static void verify();
 
-  // expensive test for pointer in metaspace for debugging
-  static bool contains(const void* x);
 #ifndef PRODUCT
   static bool contains_loader_data(ClassLoaderData* loader_data);
 #endif