src/share/vm/gc_implementation/g1/g1RootProcessor.cpp

changeset 7764
9b582718fbea
parent 7660
3ca53859c3c7
child 8070
c0205eddb317
     1.1 --- a/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp	Fri Apr 10 09:55:46 2015 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp	Thu Apr 09 10:16:45 2015 -0700
     1.3 @@ -93,11 +93,13 @@
     1.4    uint n_workers = _g1h->n_par_threads();
     1.5    assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
     1.6  
     1.7 -  uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
     1.8 -  if (new_value == n_workers) {
     1.9 -    // This thread is last. Notify the others.
    1.10 -    MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
    1.11 -    _lock.notify_all();
    1.12 +  if (n_workers > 0) {
    1.13 +    uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
    1.14 +    if (new_value == n_workers) {
    1.15 +      // This thread is last. Notify the others.
    1.16 +      MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
    1.17 +      _lock.notify_all();
    1.18 +    }
    1.19    }
    1.20  }
    1.21  
    1.22 @@ -105,7 +107,7 @@
    1.23    uint n_workers = _g1h->n_par_threads();
    1.24    assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
    1.25  
    1.26 -  if ((uint)_n_workers_discovered_strong_classes != n_workers) {
    1.27 +  if (n_workers > 0 && (uint)_n_workers_discovered_strong_classes != n_workers) {
    1.28      MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
    1.29      while ((uint)_n_workers_discovered_strong_classes != n_workers) {
    1.30        _lock.wait(Mutex::_no_safepoint_check_flag, 0, false);

mercurial