Skip to content
Permalink
Browse files
8275511: G1: Rename needs_remset_update to remset_is_tracked in G1Hea…
…pRegionAttr

Reviewed-by: tschatzl, sjohanss
  • Loading branch information
albertnetymk committed Oct 25, 2021
1 parent 0bcc174 commit 7f94302ceca001ded89ba9a653bf176ef90b16cd
Showing 7 changed files with 27 additions and 27 deletions.
@@ -2693,15 +2693,15 @@ bool G1CollectedHeap::is_potential_eager_reclaim_candidate(HeapRegion* r) const
}

#ifndef PRODUCT
void G1CollectedHeap::verify_region_attr_remset_update() {
void G1CollectedHeap::verify_region_attr_remset_is_tracked() {
class VerifyRegionAttrRemSet : public HeapRegionClosure {
public:
virtual bool do_heap_region(HeapRegion* r) {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
bool const needs_remset_update = g1h->region_attr(r->bottom()).needs_remset_update();
assert(r->rem_set()->is_tracked() == needs_remset_update,
bool const remset_is_tracked = g1h->region_attr(r->bottom()).remset_is_tracked();
assert(r->rem_set()->is_tracked() == remset_is_tracked,
"Region %u remset tracking status (%s) different to region attribute (%s)",
r->hrm_index(), BOOL_TO_STR(r->rem_set()->is_tracked()), BOOL_TO_STR(needs_remset_update));
r->hrm_index(), BOOL_TO_STR(r->rem_set()->is_tracked()), BOOL_TO_STR(remset_is_tracked));
return false;
}
} cl;
@@ -620,7 +620,7 @@ class G1CollectedHeap : public CollectedHeap {

// Verify that the G1RegionAttr remset tracking corresponds to actual remset tracking
// for all regions.
void verify_region_attr_remset_update() PRODUCT_RETURN;
void verify_region_attr_remset_is_tracked() PRODUCT_RETURN;

bool is_user_requested_concurrent_full_gc(GCCause::Cause cause);

@@ -189,7 +189,7 @@ void G1CollectedHeap::register_new_survivor_region_with_region_attr(HeapRegion*
}

void G1CollectedHeap::register_region_with_region_attr(HeapRegion* r) {
_region_attr.set_has_remset(r->hrm_index(), r->rem_set()->is_tracked());
_region_attr.set_remset_is_tracked(r->hrm_index(), r->rem_set()->is_tracked());
}

void G1CollectedHeap::register_old_region_with_region_attr(HeapRegion* r) {
@@ -513,7 +513,7 @@ bool G1CollectionSet::finalize_optional_for_evacuation(double remaining_pause_ti

stop_incremental_building();

_g1h->verify_region_attr_remset_update();
_g1h->verify_region_attr_remset_is_tracked();

return num_selected_regions > 0;
}
@@ -530,7 +530,7 @@ void G1CollectionSet::abandon_optional_collection_set(G1ParScanThreadStateSet* p
}
free_optional_regions();

_g1h->verify_region_attr_remset_update();
_g1h->verify_region_attr_remset_is_tracked();
}

#ifdef ASSERT
@@ -39,12 +39,12 @@ struct G1HeapRegionAttr {
#else
typedef int8_t region_type_t;
#endif
// _needs_remset_update_t is essentially bool, but we need precise control
// remset_is_tracked_t is essentially bool, but we need precise control
// on the size, and sizeof(bool) is implementation specific.
typedef uint8_t needs_remset_update_t;
typedef uint8_t remset_is_tracked_t;

private:
needs_remset_update_t _needs_remset_update;
remset_is_tracked_t _remset_is_tracked;
region_type_t _type;

public:
@@ -65,8 +65,8 @@ struct G1HeapRegionAttr {
static const region_type_t Old = 1; // The region is in the collection set and an old region.
static const region_type_t Num = 2;

G1HeapRegionAttr(region_type_t type = NotInCSet, bool needs_remset_update = false) :
_needs_remset_update(needs_remset_update), _type(type) {
G1HeapRegionAttr(region_type_t type = NotInCSet, bool remset_is_tracked = false) :
_remset_is_tracked(remset_is_tracked), _type(type) {

assert(is_valid(), "Invalid type %d", _type);
}
@@ -85,15 +85,15 @@ struct G1HeapRegionAttr {
}
}

bool needs_remset_update() const { return _needs_remset_update != 0; }
bool remset_is_tracked() const { return _remset_is_tracked != 0; }

void set_new_survivor() { _type = NewSurvivor; }
void set_old() { _type = Old; }
void clear_humongous() {
assert(is_humongous() || !is_in_cset(), "must be");
_type = NotInCSet;
}
void set_has_remset(bool value) { _needs_remset_update = value ? 1 : 0; }
void set_remset_is_tracked(bool value) { _remset_is_tracked = value ? 1 : 0; }

bool is_in_cset_or_humongous() const { return is_in_cset() || is_humongous(); }
bool is_in_cset() const { return type() >= Young; }
@@ -126,10 +126,10 @@ class G1HeapRegionAttrBiasedMappedArray : public G1BiasedMappedArray<G1HeapRegio
protected:
G1HeapRegionAttr default_value() const { return G1HeapRegionAttr(G1HeapRegionAttr::NotInCSet); }
public:
void set_optional(uintptr_t index, bool needs_remset_update) {
void set_optional(uintptr_t index, bool remset_is_tracked) {
assert(get_by_index(index).is_default(),
"Region attributes at index " INTPTR_FORMAT " should be default but is %s", index, get_by_index(index).get_type_str());
set_by_index(index, G1HeapRegionAttr(G1HeapRegionAttr::Optional, needs_remset_update));
set_by_index(index, G1HeapRegionAttr(G1HeapRegionAttr::Optional, remset_is_tracked));
}

void set_new_survivor_region(uintptr_t index) {
@@ -138,18 +138,18 @@ class G1HeapRegionAttrBiasedMappedArray : public G1BiasedMappedArray<G1HeapRegio
get_ref_by_index(index)->set_new_survivor();
}

void set_humongous(uintptr_t index, bool needs_remset_update) {
void set_humongous(uintptr_t index, bool remset_is_tracked) {
assert(get_by_index(index).is_default(),
"Region attributes at index " INTPTR_FORMAT " should be default but is %s", index, get_by_index(index).get_type_str());
set_by_index(index, G1HeapRegionAttr(G1HeapRegionAttr::Humongous, needs_remset_update));
set_by_index(index, G1HeapRegionAttr(G1HeapRegionAttr::Humongous, remset_is_tracked));
}

void clear_humongous(uintptr_t index) {
get_ref_by_index(index)->clear_humongous();
}

void set_has_remset(uintptr_t index, bool needs_remset_update) {
get_ref_by_index(index)->set_has_remset(needs_remset_update);
void set_remset_is_tracked(uintptr_t index, bool remset_is_tracked) {
get_ref_by_index(index)->set_remset_is_tracked(remset_is_tracked);
}

void set_in_young(uintptr_t index) {
@@ -158,10 +158,10 @@ class G1HeapRegionAttrBiasedMappedArray : public G1BiasedMappedArray<G1HeapRegio
set_by_index(index, G1HeapRegionAttr(G1HeapRegionAttr::Young, true));
}

void set_in_old(uintptr_t index, bool needs_remset_update) {
void set_in_old(uintptr_t index, bool remset_is_tracked) {
assert(get_by_index(index).is_default(),
"Region attributes at index " INTPTR_FORMAT " should be default but is %s", index, get_by_index(index).get_type_str());
set_by_index(index, G1HeapRegionAttr(G1HeapRegionAttr::Old, needs_remset_update));
set_by_index(index, G1HeapRegionAttr(G1HeapRegionAttr::Old, remset_is_tracked));
}

bool is_in_cset_or_humongous(HeapWord* addr) const { return at(addr).is_in_cset_or_humongous(); }
@@ -128,13 +128,13 @@ template <class T> void G1ParScanThreadState::enqueue_card_if_tracked(G1HeapRegi

#ifdef ASSERT
HeapRegion* const hr_obj = _g1h->heap_region_containing(o);
assert(region_attr.needs_remset_update() == hr_obj->rem_set()->is_tracked(),
assert(region_attr.remset_is_tracked() == hr_obj->rem_set()->is_tracked(),
"State flag indicating remset tracking disagrees (%s) with actual remembered set (%s) for region %u",
BOOL_TO_STR(region_attr.needs_remset_update()),
BOOL_TO_STR(region_attr.remset_is_tracked()),
BOOL_TO_STR(hr_obj->rem_set()->is_tracked()),
hr_obj->hrm_index());
#endif
if (!region_attr.needs_remset_update()) {
if (!region_attr.remset_is_tracked()) {
return;
}
size_t card_index = ct()->index_for(p);
@@ -1289,7 +1289,7 @@ class G1MergeHeapRootsTask : public WorkerTask {
r->rem_set()->set_state_complete();
#ifdef ASSERT
G1HeapRegionAttr region_attr = g1h->region_attr(r->hrm_index());
assert(region_attr.needs_remset_update(), "must be");
assert(region_attr.remset_is_tracked(), "must be");
#endif
assert(r->rem_set()->is_empty(), "At this point any humongous candidate remembered set must be empty.");

1 comment on commit 7f94302

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 7f94302 Oct 25, 2021

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.