7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
25 #define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
26
27 #include "gc/shenandoah/shenandoahHeuristics.hpp"
28 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
29 #include "gc/shenandoah/shenandoahTimingTracker.hpp"
30 #include "gc/shenandoah/shenandoahUtils.hpp"
31 #include "memory/resourceArea.hpp"
32
33 template <typename IsAlive, typename KeepAlive>
34 void ShenandoahWeakRoots::oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id) {
35 _task.work<IsAlive, KeepAlive>(worker_id, is_alive, keep_alive);
36 }
37
38 template <typename ITR>
39 ShenandoahCodeCacheRoots<ITR>::ShenandoahCodeCacheRoots() {
40 nmethod::oops_do_marking_prologue();
41 }
42
43 template <typename ITR>
44 void ShenandoahCodeCacheRoots<ITR>::code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id) {
45 ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
46 ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CodeCacheRoots, worker_id);
47 _coderoots_iterator.possibly_parallel_blobs_do(blob_cl);
48 }
49
50 template <typename ITR>
51 ShenandoahCodeCacheRoots<ITR>::~ShenandoahCodeCacheRoots() {
52 nmethod::oops_do_marking_epilogue();
53 }
54
55 class ShenandoahParallelOopsDoThreadClosure : public ThreadClosure {
|
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
25 #define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
26
27 #include "classfile/classLoaderDataGraph.hpp"
28 #include "gc/shared/oopStorageParState.inline.hpp"
29 #include "gc/shenandoah/shenandoahHeuristics.hpp"
30 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
31 #include "gc/shenandoah/shenandoahTimingTracker.hpp"
32 #include "gc/shenandoah/shenandoahUtils.hpp"
33 #include "memory/resourceArea.hpp"
34
35 template <bool CONCURRENT>
36 ShenandoahJNIHandleRoots<CONCURRENT>::ShenandoahJNIHandleRoots() :
37 _claimed(false),
38 _itr(JNIHandles::global_handles()) {
39 }
40
41 template <bool CONCURRENT>
42 template <typename T>
43 void ShenandoahJNIHandleRoots<CONCURRENT>::oops_do(T* cl, uint worker_id) {
44 if (CONCURRENT) {
45 _itr.oops_do(cl);
46 } else {
47 if (!_claimed && Atomic::cmpxchg(true, &_claimed, false) == false) {
48 ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
49 ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::JNIRoots, worker_id);
50 _itr.oops_do(cl);
51 }
52 }
53 }
54
55 template <typename IsAlive, typename KeepAlive>
56 void ShenandoahWeakRoots::oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id) {
57 _task.work<IsAlive, KeepAlive>(worker_id, is_alive, keep_alive);
58 }
59
60 template <bool CONCURRENT>
61 ShenandoahClassLoaderDataRoots<CONCURRENT>::ShenandoahClassLoaderDataRoots() {
62 ClassLoaderDataGraph::clear_claimed_marks();
63 if (CONCURRENT) {
64 ClassLoaderDataGraph_lock->lock();
65 }
66 }
67
68 template <bool CONCURRENT>
69 ShenandoahClassLoaderDataRoots<CONCURRENT>::~ShenandoahClassLoaderDataRoots() {
70 if (CONCURRENT) {
71 ClassLoaderDataGraph_lock->unlock();
72 }
73 }
74
75 template <bool CONCURRENT>
76 void ShenandoahClassLoaderDataRoots<CONCURRENT>::always_strong_cld_do(CLDClosure* clds, uint worker_id) {
77 if (CONCURRENT) {
78 ClassLoaderDataGraph::always_strong_cld_do(clds);
79 } else {
80 ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
81 ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CLDGRoots, worker_id);
82 ClassLoaderDataGraph::always_strong_cld_do(clds);
83 }
84 }
85
86 template <bool CONCURRENT>
87 void ShenandoahClassLoaderDataRoots<CONCURRENT>::cld_do(CLDClosure* clds, uint worker_id) {
88 if (CONCURRENT) {
89 ClassLoaderDataGraph::cld_do(clds);
90 } else {
91 ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
92 ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CLDGRoots, worker_id);
93 ClassLoaderDataGraph::cld_do(clds);
94 }
95 }
96
97 template <typename ITR>
98 ShenandoahCodeCacheRoots<ITR>::ShenandoahCodeCacheRoots() {
99 nmethod::oops_do_marking_prologue();
100 }
101
102 template <typename ITR>
103 void ShenandoahCodeCacheRoots<ITR>::code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id) {
104 ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
105 ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CodeCacheRoots, worker_id);
106 _coderoots_iterator.possibly_parallel_blobs_do(blob_cl);
107 }
108
109 template <typename ITR>
110 ShenandoahCodeCacheRoots<ITR>::~ShenandoahCodeCacheRoots() {
111 nmethod::oops_do_marking_epilogue();
112 }
113
114 class ShenandoahParallelOopsDoThreadClosure : public ThreadClosure {
|