1 /* |
|
2 * Copyright (c) 2005, 2019, 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/classLoaderDataGraph.hpp" |
|
28 #include "classfile/systemDictionary.hpp" |
|
29 #include "code/codeCache.hpp" |
|
30 #include "gc/parallel/parallelScavengeHeap.hpp" |
|
31 #include "gc/parallel/pcTasks.hpp" |
|
32 #include "gc/parallel/psCompactionManager.inline.hpp" |
|
33 #include "gc/parallel/psParallelCompact.inline.hpp" |
|
34 #include "gc/shared/collectedHeap.hpp" |
|
35 #include "gc/shared/gcTimer.hpp" |
|
36 #include "gc/shared/gcTraceTime.inline.hpp" |
|
37 #include "logging/log.hpp" |
|
38 #include "memory/iterator.inline.hpp" |
|
39 #include "memory/resourceArea.hpp" |
|
40 #include "memory/universe.hpp" |
|
41 #include "oops/objArrayKlass.inline.hpp" |
|
42 #include "oops/oop.inline.hpp" |
|
43 #include "prims/jvmtiExport.hpp" |
|
44 #include "runtime/jniHandles.hpp" |
|
45 #include "runtime/thread.hpp" |
|
46 #include "runtime/vmThread.hpp" |
|
47 #include "services/management.hpp" |
|
48 #include "utilities/stack.inline.hpp" |
|
49 |
|
50 // |
|
51 // CompactionWithStealingTask |
|
52 // |
|
53 |
|
54 CompactionWithStealingTask::CompactionWithStealingTask(ParallelTaskTerminator* t): |
|
55 _terminator(t) {} |
|
56 |
|
57 void CompactionWithStealingTask::do_it(GCTaskManager* manager, uint which) { |
|
58 assert(ParallelScavengeHeap::heap()->is_gc_active(), "called outside gc"); |
|
59 |
|
60 ParCompactionManager* cm = |
|
61 ParCompactionManager::gc_thread_compaction_manager(which); |
|
62 |
|
63 // Drain the stacks that have been preloaded with regions |
|
64 // that are ready to fill. |
|
65 |
|
66 cm->drain_region_stacks(); |
|
67 |
|
68 guarantee(cm->region_stack()->is_empty(), "Not empty"); |
|
69 |
|
70 size_t region_index = 0; |
|
71 |
|
72 while(true) { |
|
73 if (ParCompactionManager::steal(which, region_index)) { |
|
74 PSParallelCompact::fill_and_update_region(cm, region_index); |
|
75 cm->drain_region_stacks(); |
|
76 } else { |
|
77 if (terminator()->offer_termination()) { |
|
78 break; |
|
79 } |
|
80 // Go around again. |
|
81 } |
|
82 } |
|
83 return; |
|
84 } |
|
85 |
|
86 UpdateDensePrefixTask::UpdateDensePrefixTask( |
|
87 PSParallelCompact::SpaceId space_id, |
|
88 size_t region_index_start, |
|
89 size_t region_index_end) : |
|
90 _space_id(space_id), _region_index_start(region_index_start), |
|
91 _region_index_end(region_index_end) {} |
|
92 |
|
93 void UpdateDensePrefixTask::do_it(GCTaskManager* manager, uint which) { |
|
94 |
|
95 ParCompactionManager* cm = |
|
96 ParCompactionManager::gc_thread_compaction_manager(which); |
|
97 |
|
98 PSParallelCompact::update_and_deadwood_in_dense_prefix(cm, |
|
99 _space_id, |
|
100 _region_index_start, |
|
101 _region_index_end); |
|
102 } |
|