# HG changeset patch # User iveresov # Date 1429040747 0 # Node ID 0643c076b6c354a091d97691b07c6f8de8648e57 # Parent f79d8e8caecb4af7a53bb8997cd6678d46e480ae# Parent bd8725e803556e67ad6e8c20490a3b5a747ebfcc Merge diff -r f79d8e8caecb -r 0643c076b6c3 src/share/vm/classfile/classLoaderData.cpp --- a/src/share/vm/classfile/classLoaderData.cpp Fri Apr 10 15:27:05 2015 -0700 +++ b/src/share/vm/classfile/classLoaderData.cpp Tue Apr 14 19:45:47 2015 +0000 @@ -882,7 +882,7 @@ } Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() { - Klass* head = (Klass*)_next_klass; + Klass* head = _next_klass; while (head != NULL) { Klass* next = next_klass_in_cldg(head); diff -r f79d8e8caecb -r 0643c076b6c3 src/share/vm/classfile/classLoaderData.hpp --- a/src/share/vm/classfile/classLoaderData.hpp Fri Apr 10 15:27:05 2015 -0700 +++ b/src/share/vm/classfile/classLoaderData.hpp Tue Apr 14 19:45:47 2015 +0000 @@ -307,7 +307,7 @@ // An iterator that distributes Klasses to parallel worker threads. class ClassLoaderDataGraphKlassIteratorAtomic : public StackObj { - volatile Klass* _next_klass; + Klass* volatile _next_klass; public: ClassLoaderDataGraphKlassIteratorAtomic(); Klass* next_klass(); diff -r f79d8e8caecb -r 0643c076b6c3 src/share/vm/gc_implementation/g1/g1RootProcessor.cpp --- a/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp Fri Apr 10 15:27:05 2015 -0700 +++ b/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp Tue Apr 14 19:45:47 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);