author | tschatzl |
Wed, 16 Jan 2019 21:37:12 +0100 | |
changeset 53361 | 4a59f7042325 |
parent 53244 | 9807daeb47c4 |
child 53536 | 482109fae02b |
permissions | -rw-r--r-- |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52448
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 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52448
diff
changeset
|
25 |
#ifndef SHARE_GC_SHARED_PARALLELCLEANING_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52448
diff
changeset
|
26 |
#define SHARE_GC_SHARED_PARALLELCLEANING_HPP |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
27 |
|
53361
4a59f7042325
8217203: Some more includes to .inline.hpp files in gc header files
tschatzl
parents:
53244
diff
changeset
|
28 |
#include "classfile/classLoaderDataGraph.hpp" |
4a59f7042325
8217203: Some more includes to .inline.hpp files in gc header files
tschatzl
parents:
53244
diff
changeset
|
29 |
#include "code/codeCache.hpp" |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
30 |
#include "gc/shared/oopStorageParState.hpp" |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
31 |
#include "gc/shared/stringdedup/stringDedup.hpp" |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
32 |
#include "gc/shared/workgroup.hpp" |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
33 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
34 |
class ParallelCleaningTask; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
35 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
36 |
class StringCleaningTask : public AbstractGangTask { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
37 |
private: |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
38 |
BoolObjectClosure* _is_alive; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
39 |
StringDedupUnlinkOrOopsDoClosure * const _dedup_closure; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
40 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
41 |
OopStorage::ParState<false /* concurrent */, false /* const */> _par_state_string; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
42 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
43 |
int _initial_string_table_size; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
44 |
|
51537
a5d47d1b2a74
8209852: Counters in StringCleaningTask should be type of size_t
zgu
parents:
51524
diff
changeset
|
45 |
bool _process_strings; |
a5d47d1b2a74
8209852: Counters in StringCleaningTask should be type of size_t
zgu
parents:
51524
diff
changeset
|
46 |
volatile size_t _strings_processed; |
a5d47d1b2a74
8209852: Counters in StringCleaningTask should be type of size_t
zgu
parents:
51524
diff
changeset
|
47 |
volatile size_t _strings_removed; |
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 |
public: |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
50 |
StringCleaningTask(BoolObjectClosure* is_alive, StringDedupUnlinkOrOopsDoClosure* dedup_closure, bool process_strings); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
51 |
~StringCleaningTask(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
52 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
53 |
void work(uint worker_id); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
54 |
|
51537
a5d47d1b2a74
8209852: Counters in StringCleaningTask should be type of size_t
zgu
parents:
51524
diff
changeset
|
55 |
size_t strings_processed() const { return _strings_processed; } |
a5d47d1b2a74
8209852: Counters in StringCleaningTask should be type of size_t
zgu
parents:
51524
diff
changeset
|
56 |
size_t strings_removed() const { return _strings_removed; } |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
57 |
}; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
58 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
59 |
class CodeCacheUnloadingTask { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
60 |
|
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51959
diff
changeset
|
61 |
CodeCache::UnloadingScope _unloading_scope; |
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51959
diff
changeset
|
62 |
const bool _unloading_occurred; |
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51959
diff
changeset
|
63 |
const uint _num_workers; |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
64 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
65 |
// Variables used to claim nmethods. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
66 |
CompiledMethod* _first_nmethod; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
67 |
CompiledMethod* volatile _claimed_nmethod; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
68 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
69 |
public: |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
70 |
CodeCacheUnloadingTask(uint num_workers, BoolObjectClosure* is_alive, bool unloading_occurred); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
71 |
~CodeCacheUnloadingTask(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
72 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
73 |
private: |
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51959
diff
changeset
|
74 |
static const int MaxClaimNmethods = 16; |
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51959
diff
changeset
|
75 |
void claim_nmethods(CompiledMethod** claimed_nmethods, int *num_claimed_nmethods); |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
76 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
77 |
public: |
52385
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51959
diff
changeset
|
78 |
// Cleaning and unloading of nmethods. |
5c679ec60888
8209189: Make CompiledMethod::do_unloading more concurrent
eosterlund
parents:
51959
diff
changeset
|
79 |
void work(uint worker_id); |
51524
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
80 |
}; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
81 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
82 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
83 |
class KlassCleaningTask : public StackObj { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
84 |
volatile int _clean_klass_tree_claimed; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
85 |
ClassLoaderDataGraphKlassIteratorAtomic _klass_iterator; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
86 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
87 |
public: |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
88 |
KlassCleaningTask(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
89 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
90 |
private: |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
91 |
bool claim_clean_klass_tree_task(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
92 |
InstanceKlass* claim_next_klass(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
93 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
94 |
public: |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
95 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
96 |
void clean_klass(InstanceKlass* ik) { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
97 |
ik->clean_weak_instanceklass_links(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
98 |
} |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
99 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
100 |
void work(); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
101 |
}; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
102 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
103 |
// To minimize the remark pause times, the tasks below are done in parallel. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
104 |
class ParallelCleaningTask : public AbstractGangTask { |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
105 |
private: |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
106 |
bool _unloading_occurred; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
107 |
StringCleaningTask _string_task; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
108 |
CodeCacheUnloadingTask _code_cache_task; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
109 |
KlassCleaningTask _klass_cleaning_task; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
110 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
111 |
public: |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
112 |
// The constructor is run in the VMThread. |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
113 |
ParallelCleaningTask(BoolObjectClosure* is_alive, StringDedupUnlinkOrOopsDoClosure* dedup_closure, |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
114 |
uint num_workers, bool unloading_occurred); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
115 |
|
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
116 |
void work(uint worker_id); |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
117 |
}; |
9d01ad46daef
8209841: [REDO] Refactor G1ParallelCleaningTask into shared
zgu
parents:
diff
changeset
|
118 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52448
diff
changeset
|
119 |
#endif // SHARE_GC_SHARED_PARALLELCLEANING_HPP |