Merge
authorstefank
Fri, 10 Apr 2015 14:59:21 +0000
changeset 30168 df0c5880c78e
parent 30166 a85188117643 (current diff)
parent 30167 1a32e4a39680 (diff)
child 30169 736fe315ddcb
Merge
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp	Thu Apr 09 15:41:47 2015 +0200
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp	Fri Apr 10 14:59:21 2015 +0000
@@ -93,11 +93,13 @@
   uint n_workers = _g1h->n_par_threads();
   assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
 
-  uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
-  if (new_value == n_workers) {
-    // This thread is last. Notify the others.
-    MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
-    _lock.notify_all();
+  if (n_workers > 0) {
+    uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
+    if (new_value == n_workers) {
+      // This thread is last. Notify the others.
+      MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
+      _lock.notify_all();
+    }
   }
 }
 
@@ -105,7 +107,7 @@
   uint n_workers = _g1h->n_par_threads();
   assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
 
-  if ((uint)_n_workers_discovered_strong_classes != n_workers) {
+  if (n_workers > 0 && (uint)_n_workers_discovered_strong_classes != n_workers) {
     MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
     while ((uint)_n_workers_discovered_strong_classes != n_workers) {
       _lock.wait(Mutex::_no_safepoint_check_flag, 0, false);