hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
changeset 25908 8adb2fb6fc3c
parent 25893 b4141bec6a67
child 26157 70eddb655686
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon Aug 04 15:04:45 2014 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Aug 06 09:55:16 2014 +0200
@@ -2167,7 +2167,9 @@
   g1h->increment_total_collections();
 
   // Clean out dead classes and update Metaspace sizes.
-  ClassLoaderDataGraph::purge();
+  if (ClassUnloadingWithConcurrentMark) {
+    ClassLoaderDataGraph::purge();
+  }
   MetaspaceGC::compute_new_size();
 
   // We reclaimed old regions so we should calculate the sizes to make
@@ -2597,24 +2599,27 @@
   assert(_markStack.isEmpty(), "Marking should have completed");
 
   // Unload Klasses, String, Symbols, Code Cache, etc.
-
-  G1RemarkGCTraceTime trace("Unloading", G1Log::finer());
-
-  bool purged_classes;
-
   {
-    G1RemarkGCTraceTime trace("System Dictionary Unloading", G1Log::finest());
-    purged_classes = SystemDictionary::do_unloading(&g1_is_alive);
-  }
-
-  {
-    G1RemarkGCTraceTime trace("Parallel Unloading", G1Log::finest());
-    weakRefsWorkParallelPart(&g1_is_alive, purged_classes);
-  }
-
-  if (G1StringDedup::is_enabled()) {
-    G1RemarkGCTraceTime trace("String Deduplication Unlink", G1Log::finest());
-    G1StringDedup::unlink(&g1_is_alive);
+    G1RemarkGCTraceTime trace("Unloading", G1Log::finer());
+
+    if (ClassUnloadingWithConcurrentMark) {
+      bool purged_classes;
+
+      {
+        G1RemarkGCTraceTime trace("System Dictionary Unloading", G1Log::finest());
+        purged_classes = SystemDictionary::do_unloading(&g1_is_alive);
+      }
+
+      {
+        G1RemarkGCTraceTime trace("Parallel Unloading", G1Log::finest());
+        weakRefsWorkParallelPart(&g1_is_alive, purged_classes);
+      }
+    }
+
+    if (G1StringDedup::is_enabled()) {
+      G1RemarkGCTraceTime trace("String Deduplication Unlink", G1Log::finest());
+      G1StringDedup::unlink(&g1_is_alive);
+    }
   }
 }