Skip to content

Commit 3f73ca7

Browse files
author
Thomas Schatzl
committedSep 22, 2021
8274068: Rename G1ScanInYoungSetter to G1SkipCardEnqueueSetter
Reviewed-by: sjohanss, ayang
1 parent 7f78803 commit 3f73ca7

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed
 

‎src/hotspot/share/gc/g1/g1OopClosures.hpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ class G1ScanRSForOptionalClosure : public OopClosure {
8585

8686
// This closure is applied to the fields of the objects that have just been copied during evacuation.
8787
class G1ScanEvacuatedObjClosure : public G1ScanClosureBase {
88-
friend class G1ScanInYoungSetter;
88+
friend class G1SkipCardEnqueueSetter;
8989

90-
enum ScanningInYoungValues {
90+
enum SkipCardEnqueueTristate {
9191
False = 0,
9292
True,
9393
Uninitialized
9494
};
9595

96-
ScanningInYoungValues _scanning_in_young;
96+
SkipCardEnqueueTristate _skip_card_enqueue;
9797

9898
public:
9999
G1ScanEvacuatedObjClosure(G1CollectedHeap* g1h, G1ParScanThreadState* par_scan_state) :
100-
G1ScanClosureBase(g1h, par_scan_state), _scanning_in_young(Uninitialized) { }
100+
G1ScanClosureBase(g1h, par_scan_state), _skip_card_enqueue(Uninitialized) { }
101101

102102
template <class T> void do_oop_work(T* p);
103103
virtual void do_oop(oop* p) { do_oop_work(p); }
@@ -111,18 +111,18 @@ class G1ScanEvacuatedObjClosure : public G1ScanClosureBase {
111111
}
112112
};
113113

114-
// RAII object to properly set the _scanning_in_young field in G1ScanEvacuatedObjClosure.
115-
class G1ScanInYoungSetter : public StackObj {
114+
// RAII object to properly set the _skip_card_enqueue field in G1ScanEvacuatedObjClosure.
115+
class G1SkipCardEnqueueSetter : public StackObj {
116116
G1ScanEvacuatedObjClosure* _closure;
117117

118118
public:
119-
G1ScanInYoungSetter(G1ScanEvacuatedObjClosure* closure, bool new_value) : _closure(closure) {
120-
assert(_closure->_scanning_in_young == G1ScanEvacuatedObjClosure::Uninitialized, "Must not be set");
121-
_closure->_scanning_in_young = new_value ? G1ScanEvacuatedObjClosure::True : G1ScanEvacuatedObjClosure::False;
119+
G1SkipCardEnqueueSetter(G1ScanEvacuatedObjClosure* closure, bool new_value) : _closure(closure) {
120+
assert(_closure->_skip_card_enqueue == G1ScanEvacuatedObjClosure::Uninitialized, "Must not be set");
121+
_closure->_skip_card_enqueue = new_value ? G1ScanEvacuatedObjClosure::True : G1ScanEvacuatedObjClosure::False;
122122
}
123123

124-
~G1ScanInYoungSetter() {
125-
DEBUG_ONLY(_closure->_scanning_in_young = G1ScanEvacuatedObjClosure::Uninitialized;)
124+
~G1SkipCardEnqueueSetter() {
125+
DEBUG_ONLY(_closure->_skip_card_enqueue = G1ScanEvacuatedObjClosure::Uninitialized;)
126126
}
127127
};
128128

‎src/hotspot/share/gc/g1/g1OopClosures.inline.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ inline void G1ScanEvacuatedObjClosure::do_oop_work(T* p) {
8888
prefetch_and_push(p, obj);
8989
} else if (!HeapRegion::is_in_same_region(p, obj)) {
9090
handle_non_cset_obj_common(region_attr, p, obj);
91-
assert(_scanning_in_young != Uninitialized, "Scan location has not been initialized.");
92-
if (_scanning_in_young == True) {
91+
assert(_skip_card_enqueue != Uninitialized, "Scan location has not been initialized.");
92+
if (_skip_card_enqueue == True) {
9393
return;
9494
}
9595
_par_scan_state->enqueue_card_if_tracked(region_attr, p, obj);

‎src/hotspot/share/gc/g1/g1ParScanThreadState.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ void G1ParScanThreadState::do_partial_array(PartialArrayScanTask task) {
242242
}
243243

244244
HeapRegion* hr = _g1h->heap_region_containing(to_array);
245-
G1ScanInYoungSetter x(&_scanner, hr->is_young());
245+
G1SkipCardEnqueueSetter x(&_scanner, hr->is_young());
246246
// Process claimed task. The length of to_array is not correct, but
247247
// fortunately the iteration ignores the length field and just relies
248248
// on start/end.
@@ -274,7 +274,7 @@ void G1ParScanThreadState::start_partial_objarray(G1HeapRegionAttr dest_attr,
274274
push_on_queue(ScannerTask(PartialArrayScanTask(from_obj)));
275275
}
276276

277-
G1ScanInYoungSetter x(&_scanner, dest_attr.is_young());
277+
G1SkipCardEnqueueSetter x(&_scanner, dest_attr.is_young());
278278
// Process the initial chunk. No need to process the type in the
279279
// klass, as it will already be handled by processing the built-in
280280
// module. The length of to_array is not correct, but fortunately
@@ -519,7 +519,7 @@ oop G1ParScanThreadState::do_copy_to_survivor_space(G1HeapRegionAttr const regio
519519
_string_dedup_requests.add(old);
520520
}
521521

522-
G1ScanInYoungSetter x(&_scanner, dest_attr.is_young());
522+
G1SkipCardEnqueueSetter x(&_scanner, dest_attr.is_young());
523523
obj->oop_iterate_backwards(&_scanner, klass);
524524
return obj;
525525

@@ -606,7 +606,7 @@ oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markWord m, siz
606606
_preserved_marks->push_if_necessary(old, m);
607607
_evacuation_failed_info.register_copy_failure(word_sz);
608608

609-
G1ScanInYoungSetter x(&_scanner, r->is_young());
609+
G1SkipCardEnqueueSetter x(&_scanner, r->is_young());
610610
old->oop_iterate_backwards(&_scanner);
611611

612612
return old;

0 commit comments

Comments
 (0)
Please sign in to comment.