author | kbarrett |
Tue, 12 Jun 2018 18:12:59 -0400 | |
changeset 50532 | a18c60527166 |
parent 49911 | 358be4680d12 |
child 52141 | de6dc206a92b |
permissions | -rw-r--r-- |
33213 | 1 |
/* |
49643
a3453bbd5418
8199742: Clean up state flags in G1CollectorState
tschatzl
parents:
49336
diff
changeset
|
2 |
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
33213 | 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" |
|
34639 | 26 |
#include "gc/g1/g1OopClosures.inline.hpp" |
27 |
#include "gc/g1/g1RootClosures.hpp" |
|
28 |
#include "gc/g1/g1SharedClosures.hpp" |
|
29 |
||
30 |
// Closures used for standard G1 evacuation. |
|
31 |
class G1EvacuationClosures : public G1EvacuationRootClosures { |
|
32 |
G1SharedClosures<G1MarkNone> _closures; |
|
33 |
||
34 |
public: |
|
35 |
G1EvacuationClosures(G1CollectedHeap* g1h, |
|
36 |
G1ParScanThreadState* pss, |
|
49643
a3453bbd5418
8199742: Clean up state flags in G1CollectorState
tschatzl
parents:
49336
diff
changeset
|
37 |
bool in_young_gc) : |
a3453bbd5418
8199742: Clean up state flags in G1CollectorState
tschatzl
parents:
49336
diff
changeset
|
38 |
_closures(g1h, pss, in_young_gc, /* must_claim_cld */ false) {} |
34639 | 39 |
|
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49643
diff
changeset
|
40 |
OopClosure* weak_oops() { return &_closures._oops; } |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49643
diff
changeset
|
41 |
OopClosure* strong_oops() { return &_closures._oops; } |
34639 | 42 |
|
43 |
CLDClosure* weak_clds() { return &_closures._clds; } |
|
44 |
CLDClosure* strong_clds() { return &_closures._clds; } |
|
45 |
CLDClosure* second_pass_weak_clds() { return NULL; } |
|
46 |
||
47 |
CodeBlobClosure* strong_codeblobs() { return &_closures._codeblobs; } |
|
48 |
CodeBlobClosure* weak_codeblobs() { return &_closures._codeblobs; } |
|
49 |
||
50 |
OopClosure* raw_strong_oops() { return &_closures._oops; } |
|
51 |
||
52 |
bool trace_metadata() { return false; } |
|
53 |
}; |
|
33213 | 54 |
|
55 |
// Closures used during initial mark. |
|
56 |
// The treatment of "weak" roots is selectable through the template parameter, |
|
57 |
// this is usually used to control unloading of classes and interned strings. |
|
58 |
template <G1Mark MarkWeak> |
|
46281 | 59 |
class G1InitialMarkClosures : public G1EvacuationRootClosures { |
33213 | 60 |
G1SharedClosures<G1MarkFromRoot> _strong; |
61 |
G1SharedClosures<MarkWeak> _weak; |
|
62 |
||
63 |
// Filter method to help with returning the appropriate closures |
|
64 |
// depending on the class template parameter. |
|
65 |
template <G1Mark Mark, typename T> |
|
66 |
T* null_if(T* t) { |
|
67 |
if (Mark == MarkWeak) { |
|
68 |
return NULL; |
|
69 |
} |
|
70 |
return t; |
|
71 |
} |
|
72 |
||
73 |
public: |
|
46281 | 74 |
G1InitialMarkClosures(G1CollectedHeap* g1h, |
75 |
G1ParScanThreadState* pss) : |
|
33213 | 76 |
_strong(g1h, pss, /* process_only_dirty_klasses */ false, /* must_claim_cld */ true), |
77 |
_weak(g1h, pss, /* process_only_dirty_klasses */ false, /* must_claim_cld */ true) {} |
|
78 |
||
49911
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49643
diff
changeset
|
79 |
OopClosure* weak_oops() { return &_weak._oops; } |
358be4680d12
6672778: G1 should trim task queues more aggressively during evacuation pauses
tschatzl
parents:
49643
diff
changeset
|
80 |
OopClosure* strong_oops() { return &_strong._oops; } |
33213 | 81 |
|
82 |
// If MarkWeak is G1MarkPromotedFromRoot then the weak CLDs must be processed in a second pass. |
|
83 |
CLDClosure* weak_clds() { return null_if<G1MarkPromotedFromRoot>(&_weak._clds); } |
|
84 |
CLDClosure* strong_clds() { return &_strong._clds; } |
|
85 |
||
86 |
// If MarkWeak is G1MarkFromRoot then all CLDs are processed by the weak and strong variants |
|
87 |
// return a NULL closure for the following specialized versions in that case. |
|
88 |
CLDClosure* second_pass_weak_clds() { return null_if<G1MarkFromRoot>(&_weak._clds); } |
|
89 |
||
90 |
CodeBlobClosure* strong_codeblobs() { return &_strong._codeblobs; } |
|
91 |
CodeBlobClosure* weak_codeblobs() { return &_weak._codeblobs; } |
|
92 |
||
93 |
OopClosure* raw_strong_oops() { return &_strong._oops; } |
|
94 |
||
95 |
// If we are not marking all weak roots then we are tracing |
|
96 |
// which metadata is alive. |
|
97 |
bool trace_metadata() { return MarkWeak == G1MarkPromotedFromRoot; } |
|
98 |
}; |
|
99 |
||
100 |
G1EvacuationRootClosures* G1EvacuationRootClosures::create_root_closures(G1ParScanThreadState* pss, G1CollectedHeap* g1h) { |
|
49336
4b7dae855f23
8197843: Remove unused method G1EvacuationRootClosures::create_root_closures_ext
ehelin
parents:
47216
diff
changeset
|
101 |
G1EvacuationRootClosures* res = NULL; |
49643
a3453bbd5418
8199742: Clean up state flags in G1CollectorState
tschatzl
parents:
49336
diff
changeset
|
102 |
if (g1h->collector_state()->in_initial_mark_gc()) { |
33213 | 103 |
if (ClassUnloadingWithConcurrentMark) { |
46281 | 104 |
res = new G1InitialMarkClosures<G1MarkPromotedFromRoot>(g1h, pss); |
33213 | 105 |
} else { |
46281 | 106 |
res = new G1InitialMarkClosures<G1MarkFromRoot>(g1h, pss); |
33213 | 107 |
} |
108 |
} else { |
|
49643
a3453bbd5418
8199742: Clean up state flags in G1CollectorState
tschatzl
parents:
49336
diff
changeset
|
109 |
res = new G1EvacuationClosures(g1h, pss, g1h->collector_state()->in_young_only_phase()); |
33213 | 110 |
} |
34308
4496e81c890d
8142494: Add extension point to G1EvacuationRootClosures
ehelin
parents:
33213
diff
changeset
|
111 |
return res; |
33213 | 112 |
} |