1 /*
2 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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 #include "aot/aotLoader.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "code/codeCache.hpp"
29 #include "gc/parallel/parallelScavengeHeap.hpp"
30 #include "gc/parallel/pcTasks.hpp"
31 #include "gc/parallel/psCompactionManager.inline.hpp"
32 #include "gc/parallel/psParallelCompact.inline.hpp"
33 #include "gc/shared/collectedHeap.hpp"
34 #include "gc/shared/gcTimer.hpp"
35 #include "gc/shared/gcTraceTime.inline.hpp"
36 #include "logging/log.hpp"
37 #include "memory/resourceArea.hpp"
38 #include "memory/universe.hpp"
39 #include "oops/objArrayKlass.inline.hpp"
40 #include "oops/oop.inline.hpp"
41 #include "prims/jvmtiExport.hpp"
42 #include "runtime/fprofiler.hpp"
43 #include "runtime/jniHandles.hpp"
44 #include "runtime/thread.hpp"
45 #include "runtime/vmThread.hpp"
46 #include "services/management.hpp"
47 #include "utilities/stack.inline.hpp"
48
49 //
50 // ThreadRootsMarkingTask
51 //
52
53 void ThreadRootsMarkingTask::do_it(GCTaskManager* manager, uint which) {
54 assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc");
55
56 ResourceMark rm;
57
58 ParCompactionManager* cm =
59 ParCompactionManager::gc_thread_compaction_manager(which);
60
61 ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm);
62 MarkingCodeBlobClosure mark_and_push_in_blobs(&mark_and_push_closure, !CodeBlobToOopClosure::FixRelocations);
88 case universe:
89 Universe::oops_do(&mark_and_push_closure);
90 break;
91
92 case jni_handles:
93 JNIHandles::oops_do(&mark_and_push_closure);
94 break;
95
96 case threads:
97 {
98 ResourceMark rm;
99 MarkingCodeBlobClosure each_active_code_blob(&mark_and_push_closure, !CodeBlobToOopClosure::FixRelocations);
100 Threads::oops_do(&mark_and_push_closure, &each_active_code_blob);
101 }
102 break;
103
104 case object_synchronizer:
105 ObjectSynchronizer::oops_do(&mark_and_push_closure);
106 break;
107
108 case flat_profiler:
109 FlatProfiler::oops_do(&mark_and_push_closure);
110 break;
111
112 case management:
113 Management::oops_do(&mark_and_push_closure);
114 break;
115
116 case jvmti:
117 JvmtiExport::oops_do(&mark_and_push_closure);
118 break;
119
120 case system_dictionary:
121 SystemDictionary::always_strong_oops_do(&mark_and_push_closure);
122 break;
123
124 case class_loader_data:
125 ClassLoaderDataGraph::always_strong_oops_do(&mark_and_push_closure, &follow_klass_closure, true);
126 break;
127
128 case code_cache:
129 // Do not treat nmethods as strong roots for mark/sweep, since we can unload them.
130 //CodeCache::scavenge_root_nmethods_do(CodeBlobToOopClosure(&mark_and_push_closure));
131 AOTLoader::oops_do(&mark_and_push_closure);
|
1 /*
2 * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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 #include "aot/aotLoader.hpp"
27 #include "classfile/systemDictionary.hpp"
28 #include "code/codeCache.hpp"
29 #include "gc/parallel/parallelScavengeHeap.hpp"
30 #include "gc/parallel/pcTasks.hpp"
31 #include "gc/parallel/psCompactionManager.inline.hpp"
32 #include "gc/parallel/psParallelCompact.inline.hpp"
33 #include "gc/shared/collectedHeap.hpp"
34 #include "gc/shared/gcTimer.hpp"
35 #include "gc/shared/gcTraceTime.inline.hpp"
36 #include "logging/log.hpp"
37 #include "memory/resourceArea.hpp"
38 #include "memory/universe.hpp"
39 #include "oops/objArrayKlass.inline.hpp"
40 #include "oops/oop.inline.hpp"
41 #include "prims/jvmtiExport.hpp"
42 #include "runtime/jniHandles.hpp"
43 #include "runtime/thread.hpp"
44 #include "runtime/vmThread.hpp"
45 #include "services/management.hpp"
46 #include "utilities/stack.inline.hpp"
47
48 //
49 // ThreadRootsMarkingTask
50 //
51
52 void ThreadRootsMarkingTask::do_it(GCTaskManager* manager, uint which) {
53 assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc");
54
55 ResourceMark rm;
56
57 ParCompactionManager* cm =
58 ParCompactionManager::gc_thread_compaction_manager(which);
59
60 ParCompactionManager::MarkAndPushClosure mark_and_push_closure(cm);
61 MarkingCodeBlobClosure mark_and_push_in_blobs(&mark_and_push_closure, !CodeBlobToOopClosure::FixRelocations);
87 case universe:
88 Universe::oops_do(&mark_and_push_closure);
89 break;
90
91 case jni_handles:
92 JNIHandles::oops_do(&mark_and_push_closure);
93 break;
94
95 case threads:
96 {
97 ResourceMark rm;
98 MarkingCodeBlobClosure each_active_code_blob(&mark_and_push_closure, !CodeBlobToOopClosure::FixRelocations);
99 Threads::oops_do(&mark_and_push_closure, &each_active_code_blob);
100 }
101 break;
102
103 case object_synchronizer:
104 ObjectSynchronizer::oops_do(&mark_and_push_closure);
105 break;
106
107 case management:
108 Management::oops_do(&mark_and_push_closure);
109 break;
110
111 case jvmti:
112 JvmtiExport::oops_do(&mark_and_push_closure);
113 break;
114
115 case system_dictionary:
116 SystemDictionary::always_strong_oops_do(&mark_and_push_closure);
117 break;
118
119 case class_loader_data:
120 ClassLoaderDataGraph::always_strong_oops_do(&mark_and_push_closure, &follow_klass_closure, true);
121 break;
122
123 case code_cache:
124 // Do not treat nmethods as strong roots for mark/sweep, since we can unload them.
125 //CodeCache::scavenge_root_nmethods_do(CodeBlobToOopClosure(&mark_and_push_closure));
126 AOTLoader::oops_do(&mark_and_push_closure);
|