Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/g1RootProcessor.cpp @ 22960:9b582718fbea
8076325: java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
Summary: Added a guard of gc workers > 0 to execute logic.
Reviewed-by: stefank, mgerdin
author | sangheki |
---|---|
date | Thu, 09 Apr 2015 10:16:45 -0700 |
parents | 3ca53859c3c7 |
children | bd88fd590f4e c0205eddb317 |
comparison
equal
deleted
inserted
replaced
22959:421863f11ad7 | 22960:9b582718fbea |
---|---|
91 | 91 |
92 void G1RootProcessor::worker_has_discovered_all_strong_classes() { | 92 void G1RootProcessor::worker_has_discovered_all_strong_classes() { |
93 uint n_workers = _g1h->n_par_threads(); | 93 uint n_workers = _g1h->n_par_threads(); |
94 assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); | 94 assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); |
95 | 95 |
96 uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes); | 96 if (n_workers > 0) { |
97 if (new_value == n_workers) { | 97 uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes); |
98 // This thread is last. Notify the others. | 98 if (new_value == n_workers) { |
99 MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); | 99 // This thread is last. Notify the others. |
100 _lock.notify_all(); | 100 MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); |
101 _lock.notify_all(); | |
102 } | |
101 } | 103 } |
102 } | 104 } |
103 | 105 |
104 void G1RootProcessor::wait_until_all_strong_classes_discovered() { | 106 void G1RootProcessor::wait_until_all_strong_classes_discovered() { |
105 uint n_workers = _g1h->n_par_threads(); | 107 uint n_workers = _g1h->n_par_threads(); |
106 assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); | 108 assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); |
107 | 109 |
108 if ((uint)_n_workers_discovered_strong_classes != n_workers) { | 110 if (n_workers > 0 && (uint)_n_workers_discovered_strong_classes != n_workers) { |
109 MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); | 111 MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); |
110 while ((uint)_n_workers_discovered_strong_classes != n_workers) { | 112 while ((uint)_n_workers_discovered_strong_classes != n_workers) { |
111 _lock.wait(Mutex::_no_safepoint_check_flag, 0, false); | 113 _lock.wait(Mutex::_no_safepoint_check_flag, 0, false); |
112 } | 114 } |
113 } | 115 } |