author | stefank |
Thu, 14 Mar 2019 09:15:51 +0100 | |
changeset 54122 | 4b1426ed1c44 |
parent 53536 | 482109fae02b |
child 54669 | ad45b3802d4e |
permissions | -rw-r--r-- |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
1 |
/* |
53536
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
2 |
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
4 |
* |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
8 |
* |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
13 |
* accompanied this code). |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
14 |
* |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
18 |
* |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
21 |
* questions. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
22 |
* |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
23 |
*/ |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
24 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
26 |
#include "classfile/symbolTable.hpp" |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
27 |
#include "classfile/stringTable.hpp" |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
28 |
#include "code/codeCache.hpp" |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
29 |
#include "gc/shared/parallelCleaning.hpp" |
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51537
diff
changeset
|
30 |
#include "logging/log.hpp" |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
31 |
#include "memory/resourceArea.hpp" |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
32 |
#include "logging/log.hpp" |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
33 |
|
53536
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
34 |
StringDedupCleaningTask::StringDedupCleaningTask(BoolObjectClosure* is_alive, |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
35 |
OopClosure* keep_alive, |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
36 |
bool resize_table) : |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
37 |
AbstractGangTask("String Dedup Cleaning"), |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
38 |
_dedup_closure(is_alive, keep_alive) { |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
39 |
|
53536
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
40 |
if (StringDedup::is_enabled()) { |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
41 |
StringDedup::gc_prologue(resize_table); |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
42 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
43 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
44 |
|
53536
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
45 |
StringDedupCleaningTask::~StringDedupCleaningTask() { |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
46 |
if (StringDedup::is_enabled()) { |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
47 |
StringDedup::gc_epilogue(); |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
48 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
49 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
50 |
|
53536
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
51 |
void StringDedupCleaningTask::work(uint worker_id) { |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
52 |
if (StringDedup::is_enabled()) { |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
53 |
StringDedup::parallel_unlink(&_dedup_closure, worker_id); |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
54 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
55 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
56 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
57 |
CodeCacheUnloadingTask::CodeCacheUnloadingTask(uint num_workers, BoolObjectClosure* is_alive, bool unloading_occurred) : |
53536
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
58 |
_unloading_scope(is_alive), |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
59 |
_unloading_occurred(unloading_occurred), |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
60 |
_num_workers(num_workers), |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
61 |
_first_nmethod(NULL), |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
62 |
_claimed_nmethod(NULL) { |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
63 |
// Get first alive nmethod |
52661
4f45c682eab0
8213755: Let nmethods be is_unloading() outside of safepoints
eosterlund
parents:
52448
diff
changeset
|
64 |
CompiledMethodIterator iter(CompiledMethodIterator::only_alive); |
4f45c682eab0
8213755: Let nmethods be is_unloading() outside of safepoints
eosterlund
parents:
52448
diff
changeset
|
65 |
if(iter.next()) { |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
66 |
_first_nmethod = iter.method(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
67 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
68 |
_claimed_nmethod = _first_nmethod; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
69 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
70 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
71 |
CodeCacheUnloadingTask::~CodeCacheUnloadingTask() { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
72 |
CodeCache::verify_clean_inline_caches(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
73 |
CodeCache::verify_icholder_relocations(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
74 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
75 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
76 |
void CodeCacheUnloadingTask::claim_nmethods(CompiledMethod** claimed_nmethods, int *num_claimed_nmethods) { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
77 |
CompiledMethod* first; |
52661
4f45c682eab0
8213755: Let nmethods be is_unloading() outside of safepoints
eosterlund
parents:
52448
diff
changeset
|
78 |
CompiledMethodIterator last(CompiledMethodIterator::only_alive); |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
79 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
80 |
do { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
81 |
*num_claimed_nmethods = 0; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
82 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
83 |
first = _claimed_nmethod; |
52661
4f45c682eab0
8213755: Let nmethods be is_unloading() outside of safepoints
eosterlund
parents:
52448
diff
changeset
|
84 |
last = CompiledMethodIterator(CompiledMethodIterator::only_alive, first); |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
85 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
86 |
if (first != NULL) { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
87 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
88 |
for (int i = 0; i < MaxClaimNmethods; i++) { |
52661
4f45c682eab0
8213755: Let nmethods be is_unloading() outside of safepoints
eosterlund
parents:
52448
diff
changeset
|
89 |
if (!last.next()) { |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
90 |
break; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
91 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
92 |
claimed_nmethods[i] = last.method(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
93 |
(*num_claimed_nmethods)++; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
94 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
95 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
96 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
97 |
} while (Atomic::cmpxchg(last.method(), &_claimed_nmethod, first) != first); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
98 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
99 |
|
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51537
diff
changeset
|
100 |
void CodeCacheUnloadingTask::work(uint worker_id) { |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
101 |
// The first nmethods is claimed by the first worker. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
102 |
if (worker_id == 0 && _first_nmethod != NULL) { |
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51537
diff
changeset
|
103 |
_first_nmethod->do_unloading(_unloading_occurred); |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
104 |
_first_nmethod = NULL; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
105 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
106 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
107 |
int num_claimed_nmethods; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
108 |
CompiledMethod* claimed_nmethods[MaxClaimNmethods]; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
109 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
110 |
while (true) { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
111 |
claim_nmethods(claimed_nmethods, &num_claimed_nmethods); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
112 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
113 |
if (num_claimed_nmethods == 0) { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
114 |
break; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
115 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
116 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
117 |
for (int i = 0; i < num_claimed_nmethods; i++) { |
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51537
diff
changeset
|
118 |
claimed_nmethods[i]->do_unloading(_unloading_occurred); |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
119 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
120 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
121 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
122 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
123 |
KlassCleaningTask::KlassCleaningTask() : |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
124 |
_clean_klass_tree_claimed(0), |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
125 |
_klass_iterator() { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
126 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
127 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
128 |
bool KlassCleaningTask::claim_clean_klass_tree_task() { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
129 |
if (_clean_klass_tree_claimed) { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
130 |
return false; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
131 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
132 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
133 |
return Atomic::cmpxchg(1, &_clean_klass_tree_claimed, 0) == 0; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
134 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
135 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
136 |
InstanceKlass* KlassCleaningTask::claim_next_klass() { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
137 |
Klass* klass; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
138 |
do { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
139 |
klass =_klass_iterator.next_klass(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
140 |
} while (klass != NULL && !klass->is_instance_klass()); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
141 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
142 |
// this can be null so don't call InstanceKlass::cast |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
143 |
return static_cast<InstanceKlass*>(klass); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
144 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
145 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
146 |
void KlassCleaningTask::work() { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
147 |
ResourceMark rm; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
148 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
149 |
// One worker will clean the subklass/sibling klass tree. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
150 |
if (claim_clean_klass_tree_task()) { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
151 |
Klass::clean_subklass_tree(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
152 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
153 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
154 |
// All workers will help cleaning the classes, |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
155 |
InstanceKlass* klass; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
156 |
while ((klass = claim_next_klass()) != NULL) { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
157 |
clean_klass(klass); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
158 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
159 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
160 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
161 |
ParallelCleaningTask::ParallelCleaningTask(BoolObjectClosure* is_alive, |
53536
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
162 |
uint num_workers, |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
163 |
bool unloading_occurred, |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
164 |
bool resize_dedup_table) : |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
165 |
AbstractGangTask("Parallel Cleaning"), |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
166 |
_unloading_occurred(unloading_occurred), |
53536
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
167 |
_string_dedup_task(is_alive, NULL, resize_dedup_table), |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
168 |
_code_cache_task(num_workers, is_alive, unloading_occurred), |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
169 |
_klass_cleaning_task() { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
170 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
171 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
172 |
// The parallel work done by all worker threads. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
173 |
void ParallelCleaningTask::work(uint worker_id) { |
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51537
diff
changeset
|
174 |
// Do first pass of code cache cleaning. |
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51537
diff
changeset
|
175 |
_code_cache_task.work(worker_id); |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
176 |
|
53536
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
177 |
// Clean the string dedup data structures. |
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
52661
diff
changeset
|
178 |
_string_dedup_task.work(worker_id); |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
179 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
180 |
// Clean all klasses that were not unloaded. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
181 |
// The weak metadata in klass doesn't need to be |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
182 |
// processed if there was no unloading. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
183 |
if (_unloading_occurred) { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
184 |
_klass_cleaning_task.work(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
185 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
186 |
} |