8261356: Clean up enum G1Mark
Reviewed-by: sjohanss, tschatzl
This commit is contained in:
parent
becee6435b
commit
a00b13055a
@ -156,13 +156,7 @@ enum G1Barrier {
|
||||
G1BarrierNoOptRoots // Do not collect optional roots.
|
||||
};
|
||||
|
||||
enum G1Mark {
|
||||
G1MarkNone,
|
||||
G1MarkFromRoot,
|
||||
G1MarkPromotedFromRoot
|
||||
};
|
||||
|
||||
template <G1Barrier barrier, G1Mark do_mark_object>
|
||||
template <G1Barrier barrier, bool should_mark>
|
||||
class G1ParCopyClosure : public G1ParCopyHelper {
|
||||
public:
|
||||
G1ParCopyClosure(G1CollectedHeap* g1h, G1ParScanThreadState* par_scan_state) :
|
||||
|
@ -215,9 +215,9 @@ void G1ParCopyHelper::trim_queue_partially() {
|
||||
_par_scan_state->trim_queue_partially();
|
||||
}
|
||||
|
||||
template <G1Barrier barrier, G1Mark do_mark_object>
|
||||
template <G1Barrier barrier, bool should_mark>
|
||||
template <class T>
|
||||
void G1ParCopyClosure<barrier, do_mark_object>::do_oop_work(T* p) {
|
||||
void G1ParCopyClosure<barrier, should_mark>::do_oop_work(T* p) {
|
||||
T heap_oop = RawAccess<>::oop_load(p);
|
||||
|
||||
if (CompressedOops::is_null(heap_oop)) {
|
||||
@ -250,9 +250,10 @@ void G1ParCopyClosure<barrier, do_mark_object>::do_oop_work(T* p) {
|
||||
_par_scan_state->remember_root_into_optional_region(p);
|
||||
}
|
||||
|
||||
// The object is not in collection set. If we're a root scanning
|
||||
// closure during a concurrent start pause then attempt to mark the object.
|
||||
if (do_mark_object == G1MarkFromRoot) {
|
||||
// The object is not in the collection set. should_mark is true iff the
|
||||
// current closure is applied on strong roots (and weak roots when class
|
||||
// unloading is disabled) in a concurrent mark start pause.
|
||||
if (should_mark) {
|
||||
mark_object(obj);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
// Closures used for standard G1 evacuation.
|
||||
class G1EvacuationClosures : public G1EvacuationRootClosures {
|
||||
G1SharedClosures<G1MarkNone> _closures;
|
||||
G1SharedClosures<false> _closures;
|
||||
|
||||
public:
|
||||
G1EvacuationClosures(G1CollectedHeap* g1h,
|
||||
@ -50,10 +50,10 @@ public:
|
||||
// Closures used during concurrent start.
|
||||
// The treatment of "weak" roots is selectable through the template parameter,
|
||||
// this is usually used to control unloading of classes and interned strings.
|
||||
template <G1Mark MarkWeak>
|
||||
template <bool should_mark_weak>
|
||||
class G1ConcurrentStartMarkClosures : public G1EvacuationRootClosures {
|
||||
G1SharedClosures<G1MarkFromRoot> _strong;
|
||||
G1SharedClosures<MarkWeak> _weak;
|
||||
G1SharedClosures<true> _strong;
|
||||
G1SharedClosures<should_mark_weak> _weak;
|
||||
|
||||
public:
|
||||
G1ConcurrentStartMarkClosures(G1CollectedHeap* g1h,
|
||||
@ -75,9 +75,9 @@ G1EvacuationRootClosures* G1EvacuationRootClosures::create_root_closures(G1ParSc
|
||||
G1EvacuationRootClosures* res = NULL;
|
||||
if (g1h->collector_state()->in_concurrent_start_gc()) {
|
||||
if (ClassUnloadingWithConcurrentMark) {
|
||||
res = new G1ConcurrentStartMarkClosures<G1MarkPromotedFromRoot>(g1h, pss);
|
||||
res = new G1ConcurrentStartMarkClosures<false>(g1h, pss);
|
||||
} else {
|
||||
res = new G1ConcurrentStartMarkClosures<G1MarkFromRoot>(g1h, pss);
|
||||
res = new G1ConcurrentStartMarkClosures<true>(g1h, pss);
|
||||
}
|
||||
} else {
|
||||
res = new G1EvacuationClosures(g1h, pss, g1h->collector_state()->in_young_only_phase());
|
||||
|
@ -30,16 +30,11 @@ class G1CollectedHeap;
|
||||
class G1ParScanThreadState;
|
||||
|
||||
// Simple holder object for a complete set of closures used by the G1 evacuation code.
|
||||
template <G1Mark Mark>
|
||||
template <bool should_mark>
|
||||
class G1SharedClosures {
|
||||
static bool needs_strong_processing() {
|
||||
// Request strong code root processing when G1MarkFromRoot is passed in during
|
||||
// concurrent start.
|
||||
return Mark == G1MarkFromRoot;
|
||||
}
|
||||
public:
|
||||
G1ParCopyClosure<G1BarrierNone, Mark> _oops;
|
||||
G1ParCopyClosure<G1BarrierCLD, Mark> _oops_in_cld;
|
||||
G1ParCopyClosure<G1BarrierNone, should_mark> _oops;
|
||||
G1ParCopyClosure<G1BarrierCLD, should_mark> _oops_in_cld;
|
||||
// We do not need (and actually should not) collect oops from nmethods into the
|
||||
// optional collection set as we already automatically collect the corresponding
|
||||
// nmethods in the region's strong code roots set. So set G1BarrierNoOptRoots in
|
||||
@ -47,7 +42,7 @@ public:
|
||||
// If these were present there would be opportunity for multiple threads to try
|
||||
// to change this oop* at the same time. Since embedded oops are not necessarily
|
||||
// word-aligned, this could lead to word tearing during update and crashes.
|
||||
G1ParCopyClosure<G1BarrierNoOptRoots, Mark> _oops_in_nmethod;
|
||||
G1ParCopyClosure<G1BarrierNoOptRoots, should_mark> _oops_in_nmethod;
|
||||
|
||||
G1CLDScanClosure _clds;
|
||||
G1CodeBlobClosure _codeblobs;
|
||||
@ -57,5 +52,5 @@ public:
|
||||
_oops_in_cld(g1h, pss),
|
||||
_oops_in_nmethod(g1h, pss),
|
||||
_clds(&_oops_in_cld, process_only_dirty),
|
||||
_codeblobs(pss->worker_id(), &_oops_in_nmethod, needs_strong_processing()) {}
|
||||
_codeblobs(pss->worker_id(), &_oops_in_nmethod, should_mark) {}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user