Mercurial > hg > graal-jvmci-8
annotate src/share/vm/gc_implementation/g1/g1RootProcessor.cpp @ 24234:ea6f94ab283b default tip
Added tag jvmci-0.36 for changeset 8128b98d4736
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Mon, 18 Sep 2017 18:49:45 +0200 |
parents | b5f3a471e646 |
children |
rev | line source |
---|---|
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
1 /* |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
4 * |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
8 * |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
13 * accompanied this code). |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
14 * |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
18 * |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
21 * questions. |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
22 * |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
23 */ |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
24 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
26 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
27 #include "classfile/symbolTable.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
28 #include "classfile/systemDictionary.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
29 #include "code/codeCache.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
30 #include "gc_implementation/g1/bufferingOopClosure.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
31 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
32 #include "gc_implementation/g1/g1CollectorPolicy.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
33 #include "gc_implementation/g1/g1GCPhaseTimes.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
34 #include "gc_implementation/g1/g1RemSet.inline.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
35 #include "gc_implementation/g1/g1RootProcessor.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
36 #include "memory/allocation.inline.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
37 #include "runtime/fprofiler.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
38 #include "runtime/mutex.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
39 #include "services/management.hpp" |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
40 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
41 class G1CodeBlobClosure : public CodeBlobClosure { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
42 class HeapRegionGatheringOopClosure : public OopClosure { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
43 G1CollectedHeap* _g1h; |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
44 OopClosure* _work; |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
45 nmethod* _nm; |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
46 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
47 template <typename T> |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
48 void do_oop_work(T* p) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
49 _work->do_oop(p); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
50 T oop_or_narrowoop = oopDesc::load_heap_oop(p); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
51 if (!oopDesc::is_null(oop_or_narrowoop)) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
52 oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
53 HeapRegion* hr = _g1h->heap_region_containing_raw(o); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
54 assert(!_g1h->obj_in_cs(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in CS then evacuation failed and nm must already be in the remset"); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
55 hr->add_strong_code_root(_nm); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
56 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
57 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
58 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
59 public: |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
60 HeapRegionGatheringOopClosure(OopClosure* oc) : _g1h(G1CollectedHeap::heap()), _work(oc), _nm(NULL) {} |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
61 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
62 void do_oop(oop* o) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
63 do_oop_work(o); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
64 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
65 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
66 void do_oop(narrowOop* o) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
67 do_oop_work(o); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
68 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
69 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
70 void set_nm(nmethod* nm) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
71 _nm = nm; |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
72 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
73 }; |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
74 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
75 HeapRegionGatheringOopClosure _oc; |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
76 public: |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
77 G1CodeBlobClosure(OopClosure* oc) : _oc(oc) {} |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
78 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
79 void do_code_blob(CodeBlob* cb) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
80 nmethod* nm = cb->as_nmethod_or_null(); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
81 if (nm != NULL) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
82 if (!nm->test_set_oops_do_mark()) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
83 _oc.set_nm(nm); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
84 nm->oops_do(&_oc); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
85 nm->fix_oop_relocations(); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
86 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
87 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
88 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
89 }; |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
90 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
91 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
92 void G1RootProcessor::worker_has_discovered_all_strong_classes() { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
93 uint n_workers = _g1h->n_par_threads(); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
94 assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
95 |
22960
9b582718fbea
8076325: java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
sangheki
parents:
22910
diff
changeset
|
96 if (n_workers > 0) { |
9b582718fbea
8076325: java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
sangheki
parents:
22910
diff
changeset
|
97 uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes); |
9b582718fbea
8076325: java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
sangheki
parents:
22910
diff
changeset
|
98 if (new_value == n_workers) { |
9b582718fbea
8076325: java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
sangheki
parents:
22910
diff
changeset
|
99 // This thread is last. Notify the others. |
9b582718fbea
8076325: java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
sangheki
parents:
22910
diff
changeset
|
100 MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); |
9b582718fbea
8076325: java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
sangheki
parents:
22910
diff
changeset
|
101 _lock.notify_all(); |
9b582718fbea
8076325: java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
sangheki
parents:
22910
diff
changeset
|
102 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
103 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
104 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
105 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
106 void G1RootProcessor::wait_until_all_strong_classes_discovered() { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
107 uint n_workers = _g1h->n_par_threads(); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
108 assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading"); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
109 |
22960
9b582718fbea
8076325: java hangs with -XX:ParallelGCThreads=0 -XX:+ExplicitGCInvokesConcurrent options
sangheki
parents:
22910
diff
changeset
|
110 if (n_workers > 0 && (uint)_n_workers_discovered_strong_classes != n_workers) { |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
111 MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
112 while ((uint)_n_workers_discovered_strong_classes != n_workers) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
113 _lock.wait(Mutex::_no_safepoint_check_flag, 0, false); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
114 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
115 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
116 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
117 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
118 G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h) : |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
119 _g1h(g1h), |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
120 _process_strong_tasks(G1RP_PS_NumElements), |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
121 _srs(g1h), |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
122 _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false), |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
123 _n_workers_discovered_strong_classes(0) {} |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
124 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
125 void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
126 OopClosure* scan_non_heap_weak_roots, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
127 CLDClosure* scan_strong_clds, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
128 CLDClosure* scan_weak_clds, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
129 bool trace_metadata, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
130 uint worker_i) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
131 // First scan the shared roots. |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
132 double ext_roots_start = os::elapsedTime(); |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
133 G1GCPhaseTimes* phase_times = _g1h->g1_policy()->phase_times(); |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
134 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
135 BufferingOopClosure buf_scan_non_heap_roots(scan_non_heap_roots); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
136 BufferingOopClosure buf_scan_non_heap_weak_roots(scan_non_heap_weak_roots); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
137 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
138 OopClosure* const weak_roots = &buf_scan_non_heap_weak_roots; |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
139 OopClosure* const strong_roots = &buf_scan_non_heap_roots; |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
140 |
23287
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
141 bool trace_codecache = false; |
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
142 #if INCLUDE_JVMCI |
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
143 bool during_im = _g1h->g1_policy()->during_initial_mark_pause(); |
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
144 // Without eager nmethod unloading, we need to treat all oops in code cache as strong during the initial mark |
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
145 trace_codecache = during_im && !ClassUnloadingWithConcurrentMark; |
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
146 #endif |
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
147 |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
148 // CodeBlobClosures are not interoperable with BufferingOopClosures |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
149 G1CodeBlobClosure root_code_blobs(scan_non_heap_roots); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
150 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
151 process_java_roots(strong_roots, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
152 trace_metadata ? scan_strong_clds : NULL, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
153 scan_strong_clds, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
154 trace_metadata ? NULL : scan_weak_clds, |
23287
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
155 trace_codecache ? NULL : &root_code_blobs, |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
156 phase_times, |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
157 worker_i); |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
158 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
159 // This is the point where this worker thread will not find more strong CLDs/nmethods. |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
160 // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing. |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
161 if (trace_metadata) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
162 worker_has_discovered_all_strong_classes(); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
163 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
164 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
165 process_vm_roots(strong_roots, weak_roots, phase_times, worker_i); |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
166 |
23287
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
167 #if INCLUDE_JVMCI |
23660 | 168 if (trace_codecache && !_process_strong_tasks.is_task_claimed(G1RP_PS_CodeCache_oops_do)) { |
23287
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
169 CodeCache::blobs_do(&root_code_blobs); |
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
170 } |
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
171 #endif |
bd88fd590f4e
Restore G1 changes from e13c65f874e5 after merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
22960
diff
changeset
|
172 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
173 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
174 // Now the CM ref_processor roots. |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
175 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i); |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
176 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_refProcessor_oops_do)) { |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
177 // We need to treat the discovered reference lists of the |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
178 // concurrent mark ref processor as roots and keep entries |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
179 // (which are added by the marking threads) on them live |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
180 // until they can be processed at the end of marking. |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
181 _g1h->ref_processor_cm()->weak_oops_do(&buf_scan_non_heap_roots); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
182 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
183 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
184 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
185 if (trace_metadata) { |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
186 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
187 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::WaitForStrongCLD, worker_i); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
188 // Barrier to make sure all workers passed |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
189 // the strong CLD and strong nmethods phases. |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
190 wait_until_all_strong_classes_discovered(); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
191 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
192 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
193 // Now take the complement of the strong CLDs. |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
194 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::WeakCLDRoots, worker_i); |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
195 ClassLoaderDataGraph::roots_cld_do(NULL, scan_weak_clds); |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
196 } else { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
197 phase_times->record_time_secs(G1GCPhaseTimes::WaitForStrongCLD, worker_i, 0.0); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
198 phase_times->record_time_secs(G1GCPhaseTimes::WeakCLDRoots, worker_i, 0.0); |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
199 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
200 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
201 // Finish up any enqueued closure apps (attributed as object copy time). |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
202 buf_scan_non_heap_roots.done(); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
203 buf_scan_non_heap_weak_roots.done(); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
204 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
205 double obj_copy_time_sec = buf_scan_non_heap_roots.closure_app_seconds() |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
206 + buf_scan_non_heap_weak_roots.closure_app_seconds(); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
207 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
208 phase_times->record_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
209 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
210 double ext_root_time_sec = os::elapsedTime() - ext_roots_start - obj_copy_time_sec; |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
211 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
212 phase_times->record_time_secs(G1GCPhaseTimes::ExtRootScan, worker_i, ext_root_time_sec); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
213 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
214 // During conc marking we have to filter the per-thread SATB buffers |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
215 // to make sure we remove any oops into the CSet (which will show up |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
216 // as implicitly live). |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
217 { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
218 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SATBFiltering, worker_i); |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
219 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_filter_satb_buffers) && _g1h->mark_in_progress()) { |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
220 JavaThread::satb_mark_queue_set().filter_thread_buffers(); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
221 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
222 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
223 |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
224 _process_strong_tasks.all_tasks_completed(); |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
225 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
226 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
227 void G1RootProcessor::process_strong_roots(OopClosure* oops, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
228 CLDClosure* clds, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
229 CodeBlobClosure* blobs) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
230 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
231 process_java_roots(oops, clds, clds, NULL, blobs, NULL, 0); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
232 process_vm_roots(oops, NULL, NULL, 0); |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
233 |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
234 _process_strong_tasks.all_tasks_completed(); |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
235 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
236 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
237 void G1RootProcessor::process_all_roots(OopClosure* oops, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
238 CLDClosure* clds, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
239 CodeBlobClosure* blobs) { |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
240 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
241 process_java_roots(oops, NULL, clds, clds, NULL, NULL, 0); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
242 process_vm_roots(oops, oops, NULL, 0); |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
243 |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
244 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_CodeCache_oops_do)) { |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
245 CodeCache::blobs_do(blobs); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
246 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
247 |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
248 _process_strong_tasks.all_tasks_completed(); |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
249 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
250 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
251 void G1RootProcessor::process_java_roots(OopClosure* strong_roots, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
252 CLDClosure* thread_stack_clds, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
253 CLDClosure* strong_clds, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
254 CLDClosure* weak_clds, |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
255 CodeBlobClosure* strong_code, |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
256 G1GCPhaseTimes* phase_times, |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
257 uint worker_i) { |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
258 assert(thread_stack_clds == NULL || weak_clds == NULL, "There is overlap between those, only one may be set"); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
259 // Iterating over the CLDG and the Threads are done early to allow us to |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
260 // first process the strong CLDs and nmethods and then, after a barrier, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
261 // let the thread process the weak CLDs and nmethods. |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
262 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
263 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_i); |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
264 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_ClassLoaderDataGraph_oops_do)) { |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
265 ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
266 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
267 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
268 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
269 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
270 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ThreadRoots, worker_i); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
271 Threads::possibly_parallel_oops_do(strong_roots, thread_stack_clds, strong_code); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
272 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
273 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
274 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
275 void G1RootProcessor::process_vm_roots(OopClosure* strong_roots, |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
276 OopClosure* weak_roots, |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
277 G1GCPhaseTimes* phase_times, |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
278 uint worker_i) { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
279 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
280 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::UniverseRoots, worker_i); |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
281 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_Universe_oops_do)) { |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
282 Universe::oops_do(strong_roots); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
283 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
284 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
285 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
286 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
287 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JNIRoots, worker_i); |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
288 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_JNIHandles_oops_do)) { |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
289 JNIHandles::oops_do(strong_roots); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
290 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
291 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
292 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
293 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
294 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ObjectSynchronizerRoots, worker_i); |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
295 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_ObjectSynchronizer_oops_do)) { |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
296 ObjectSynchronizer::oops_do(strong_roots); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
297 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
298 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
299 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
300 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
301 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::FlatProfilerRoots, worker_i); |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
302 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_FlatProfiler_oops_do)) { |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
303 FlatProfiler::oops_do(strong_roots); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
304 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
305 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
306 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
307 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
308 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i); |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
309 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_Management_oops_do)) { |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
310 Management::oops_do(strong_roots); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
311 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
312 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
313 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
314 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
315 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_i); |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
316 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_jvmti_oops_do)) { |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
317 JvmtiExport::oops_do(strong_roots); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
318 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
319 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
320 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
321 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
322 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i); |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
323 if (!_process_strong_tasks.is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) { |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
324 SystemDictionary::roots_oops_do(strong_roots, weak_roots); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
325 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
326 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
327 |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
328 { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
329 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::StringTableRoots, worker_i); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
330 // All threads execute the following. A specific chunk of buckets |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
331 // from the StringTable are the individual tasks. |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
332 if (weak_roots != NULL) { |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
333 StringTable::possibly_parallel_oops_do(weak_roots); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
334 } |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
335 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
336 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
337 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
338 void G1RootProcessor::scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
339 OopClosure* scan_non_heap_weak_roots, |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
340 uint worker_i) { |
22910
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
341 G1GCPhaseTimes* phase_times = _g1h->g1_policy()->phase_times(); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
342 G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CodeCacheRoots, worker_i); |
3ca53859c3c7
8027962: Per-phase timing measurements for strong roots processing
brutisso
parents:
22909
diff
changeset
|
343 |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
344 // Now scan the complement of the collection set. |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
345 G1CodeBlobClosure scavenge_cs_nmethods(scan_non_heap_weak_roots); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
346 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
347 _g1h->g1_rem_set()->oops_into_collection_set_do(scan_rs, &scavenge_cs_nmethods, worker_i); |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
348 } |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
349 |
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
350 void G1RootProcessor::set_num_workers(int active_workers) { |
23423
c0205eddb317
8133193: Memory leak in G1 because G1RootProcessor doesn't have desctructor
mgerdin
parents:
22960
diff
changeset
|
351 _process_strong_tasks.set_n_threads(active_workers); |
22909
38d6febe66af
8075210: Refactor strong root processing in order to allow G1 to evolve separately from GenCollectedHeap
mgerdin
parents:
diff
changeset
|
352 } |