Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8274068: Rename G1ScanInYoungSetter to G1SkipCardEnqueueSetter
Reviewed-by: sjohanss, ayang
  • Loading branch information
Thomas Schatzl committed Sep 22, 2021
1 parent 7f78803 commit 3f73ca7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
22 changes: 11 additions & 11 deletions src/hotspot/share/gc/g1/g1OopClosures.hpp
Expand Up @@ -85,19 +85,19 @@ class G1ScanRSForOptionalClosure : public OopClosure {

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

enum ScanningInYoungValues {
enum SkipCardEnqueueTristate {
False = 0,
True,
Uninitialized
};

ScanningInYoungValues _scanning_in_young;
SkipCardEnqueueTristate _skip_card_enqueue;

public:
G1ScanEvacuatedObjClosure(G1CollectedHeap* g1h, G1ParScanThreadState* par_scan_state) :
G1ScanClosureBase(g1h, par_scan_state), _scanning_in_young(Uninitialized) { }
G1ScanClosureBase(g1h, par_scan_state), _skip_card_enqueue(Uninitialized) { }

template <class T> void do_oop_work(T* p);
virtual void do_oop(oop* p) { do_oop_work(p); }
Expand All @@ -111,18 +111,18 @@ class G1ScanEvacuatedObjClosure : public G1ScanClosureBase {
}
};

// RAII object to properly set the _scanning_in_young field in G1ScanEvacuatedObjClosure.
class G1ScanInYoungSetter : public StackObj {
// RAII object to properly set the _skip_card_enqueue field in G1ScanEvacuatedObjClosure.
class G1SkipCardEnqueueSetter : public StackObj {
G1ScanEvacuatedObjClosure* _closure;

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

~G1ScanInYoungSetter() {
DEBUG_ONLY(_closure->_scanning_in_young = G1ScanEvacuatedObjClosure::Uninitialized;)
~G1SkipCardEnqueueSetter() {
DEBUG_ONLY(_closure->_skip_card_enqueue = G1ScanEvacuatedObjClosure::Uninitialized;)
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1OopClosures.inline.hpp
Expand Up @@ -88,8 +88,8 @@ inline void G1ScanEvacuatedObjClosure::do_oop_work(T* p) {
prefetch_and_push(p, obj);
} else if (!HeapRegion::is_in_same_region(p, obj)) {
handle_non_cset_obj_common(region_attr, p, obj);
assert(_scanning_in_young != Uninitialized, "Scan location has not been initialized.");
if (_scanning_in_young == True) {
assert(_skip_card_enqueue != Uninitialized, "Scan location has not been initialized.");
if (_skip_card_enqueue == True) {
return;
}
_par_scan_state->enqueue_card_if_tracked(region_attr, p, obj);
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/gc/g1/g1ParScanThreadState.cpp
Expand Up @@ -242,7 +242,7 @@ void G1ParScanThreadState::do_partial_array(PartialArrayScanTask task) {
}

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

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

G1ScanInYoungSetter x(&_scanner, dest_attr.is_young());
G1SkipCardEnqueueSetter x(&_scanner, dest_attr.is_young());
obj->oop_iterate_backwards(&_scanner, klass);
return obj;

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

G1ScanInYoungSetter x(&_scanner, r->is_young());
G1SkipCardEnqueueSetter x(&_scanner, r->is_young());
old->oop_iterate_backwards(&_scanner);

return old;
Expand Down

1 comment on commit 3f73ca7

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.