提交 fef3ee77 编写于 作者: I iveresov

Merge

...@@ -882,7 +882,7 @@ Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass_in_cldg(Klass* klass) ...@@ -882,7 +882,7 @@ Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass_in_cldg(Klass* klass)
} }
Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() { Klass* ClassLoaderDataGraphKlassIteratorAtomic::next_klass() {
Klass* head = (Klass*)_next_klass; Klass* head = _next_klass;
while (head != NULL) { while (head != NULL) {
Klass* next = next_klass_in_cldg(head); Klass* next = next_klass_in_cldg(head);
......
...@@ -307,7 +307,7 @@ class ClassLoaderData : public CHeapObj<mtClass> { ...@@ -307,7 +307,7 @@ class ClassLoaderData : public CHeapObj<mtClass> {
// An iterator that distributes Klasses to parallel worker threads. // An iterator that distributes Klasses to parallel worker threads.
class ClassLoaderDataGraphKlassIteratorAtomic : public StackObj { class ClassLoaderDataGraphKlassIteratorAtomic : public StackObj {
volatile Klass* _next_klass; Klass* volatile _next_klass;
public: public:
ClassLoaderDataGraphKlassIteratorAtomic(); ClassLoaderDataGraphKlassIteratorAtomic();
Klass* next_klass(); Klass* next_klass();
......
...@@ -93,11 +93,13 @@ void G1RootProcessor::worker_has_discovered_all_strong_classes() { ...@@ -93,11 +93,13 @@ void G1RootProcessor::worker_has_discovered_all_strong_classes() {
uint n_workers = _g1h->n_par_threads(); uint n_workers = _g1h->n_par_threads();
assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes); if (n_workers > 0) {
if (new_value == n_workers) { uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
// This thread is last. Notify the others. if (new_value == n_workers) {
MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); // This thread is last. Notify the others.
_lock.notify_all(); MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
_lock.notify_all();
}
} }
} }
...@@ -105,7 +107,7 @@ void G1RootProcessor::wait_until_all_strong_classes_discovered() { ...@@ -105,7 +107,7 @@ void G1RootProcessor::wait_until_all_strong_classes_discovered() {
uint n_workers = _g1h->n_par_threads(); uint n_workers = _g1h->n_par_threads();
assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); 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); MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
while ((uint)_n_workers_discovered_strong_classes != n_workers) { while ((uint)_n_workers_discovered_strong_classes != n_workers) {
_lock.wait(Mutex::_no_safepoint_check_flag, 0, false); _lock.wait(Mutex::_no_safepoint_check_flag, 0, false);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册