12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26
27 #include "aot/aotLoader.hpp"
28 #include "classfile/stringTable.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "code/codeCache.hpp"
31 #include "gc/g1/bufferingOopClosure.hpp"
32 #include "gc/g1/g1CodeBlobClosure.hpp"
33 #include "gc/g1/g1CollectedHeap.inline.hpp"
34 #include "gc/g1/g1CollectorState.hpp"
35 #include "gc/g1/g1GCPhaseTimes.hpp"
36 #include "gc/g1/g1Policy.hpp"
37 #include "gc/g1/g1RootClosures.hpp"
38 #include "gc/g1/g1RootProcessor.hpp"
39 #include "gc/g1/heapRegion.inline.hpp"
40 #include "memory/allocation.inline.hpp"
41 #include "runtime/fprofiler.hpp"
42 #include "runtime/mutex.hpp"
43 #include "services/management.hpp"
44
45 void G1RootProcessor::worker_has_discovered_all_strong_classes() {
46 assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
47
48 uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
49 if (new_value == n_workers()) {
50 // This thread is last. Notify the others.
51 MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
116 assert(closures->second_pass_weak_clds() == NULL, "Should be null if not tracing metadata.");
117 }
118
119 // Finish up any enqueued closure apps (attributed as object copy time).
120 closures->flush();
121
122 double obj_copy_time_sec = closures->closure_app_seconds();
123
124 phase_times->record_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec);
125
126 double ext_root_time_sec = os::elapsedTime() - ext_roots_start - obj_copy_time_sec;
127
128 phase_times->record_time_secs(G1GCPhaseTimes::ExtRootScan, worker_i, ext_root_time_sec);
129
130 // During conc marking we have to filter the per-thread SATB buffers
131 // to make sure we remove any oops into the CSet (which will show up
132 // as implicitly live).
133 {
134 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SATBFiltering, worker_i);
135 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_filter_satb_buffers) && _g1h->collector_state()->mark_in_progress()) {
136 JavaThread::satb_mark_queue_set().filter_thread_buffers();
137 }
138 }
139
140 _process_strong_tasks.all_tasks_completed(n_workers());
141 }
142
143 // Adaptor to pass the closures to the strong roots in the VM.
144 class StrongRootsClosures : public G1RootClosures {
145 OopClosure* _roots;
146 CLDClosure* _clds;
147 CodeBlobClosure* _blobs;
148 public:
149 StrongRootsClosures(OopClosure* roots, CLDClosure* clds, CodeBlobClosure* blobs) :
150 _roots(roots), _clds(clds), _blobs(blobs) {}
151
152 OopClosure* weak_oops() { return NULL; }
153 OopClosure* strong_oops() { return _roots; }
154
155 CLDClosure* weak_clds() { return NULL; }
156 CLDClosure* strong_clds() { return _clds; }
|
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26
27 #include "aot/aotLoader.hpp"
28 #include "classfile/stringTable.hpp"
29 #include "classfile/systemDictionary.hpp"
30 #include "code/codeCache.hpp"
31 #include "gc/g1/bufferingOopClosure.hpp"
32 #include "gc/g1/g1BarrierSet.hpp"
33 #include "gc/g1/g1CodeBlobClosure.hpp"
34 #include "gc/g1/g1CollectedHeap.inline.hpp"
35 #include "gc/g1/g1CollectorState.hpp"
36 #include "gc/g1/g1GCPhaseTimes.hpp"
37 #include "gc/g1/g1Policy.hpp"
38 #include "gc/g1/g1RootClosures.hpp"
39 #include "gc/g1/g1RootProcessor.hpp"
40 #include "gc/g1/heapRegion.inline.hpp"
41 #include "memory/allocation.inline.hpp"
42 #include "runtime/fprofiler.hpp"
43 #include "runtime/mutex.hpp"
44 #include "services/management.hpp"
45
46 void G1RootProcessor::worker_has_discovered_all_strong_classes() {
47 assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
48
49 uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
50 if (new_value == n_workers()) {
51 // This thread is last. Notify the others.
52 MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
117 assert(closures->second_pass_weak_clds() == NULL, "Should be null if not tracing metadata.");
118 }
119
120 // Finish up any enqueued closure apps (attributed as object copy time).
121 closures->flush();
122
123 double obj_copy_time_sec = closures->closure_app_seconds();
124
125 phase_times->record_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec);
126
127 double ext_root_time_sec = os::elapsedTime() - ext_roots_start - obj_copy_time_sec;
128
129 phase_times->record_time_secs(G1GCPhaseTimes::ExtRootScan, worker_i, ext_root_time_sec);
130
131 // During conc marking we have to filter the per-thread SATB buffers
132 // to make sure we remove any oops into the CSet (which will show up
133 // as implicitly live).
134 {
135 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SATBFiltering, worker_i);
136 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_filter_satb_buffers) && _g1h->collector_state()->mark_in_progress()) {
137 G1BarrierSet::satb_mark_queue_set().filter_thread_buffers();
138 }
139 }
140
141 _process_strong_tasks.all_tasks_completed(n_workers());
142 }
143
144 // Adaptor to pass the closures to the strong roots in the VM.
145 class StrongRootsClosures : public G1RootClosures {
146 OopClosure* _roots;
147 CLDClosure* _clds;
148 CodeBlobClosure* _blobs;
149 public:
150 StrongRootsClosures(OopClosure* roots, CLDClosure* clds, CodeBlobClosure* blobs) :
151 _roots(roots), _clds(clds), _blobs(blobs) {}
152
153 OopClosure* weak_oops() { return NULL; }
154 OopClosure* strong_oops() { return _roots; }
155
156 CLDClosure* weak_clds() { return NULL; }
157 CLDClosure* strong_clds() { return _clds; }
|