8334293: G1: Refactor G1ConcurrentMark::update_top_at_rebuild_start

Reviewed-by: tschatzl, iwalulya
This commit is contained in:
Albert Mingkun Yang 2024-06-18 08:27:26 +00:00
parent 99fefec092
commit 0665195e59
3 changed files with 3 additions and 17 deletions

@ -214,17 +214,14 @@ inline HeapWord* G1ConcurrentMark::top_at_rebuild_start(G1HeapRegion* r) const {
}
inline void G1ConcurrentMark::update_top_at_rebuild_start(G1HeapRegion* r) {
assert(r->is_old() || r->is_humongous(), "precondition");
uint const region = r->hrm_index();
assert(region < _g1h->max_reserved_regions(), "Tried to access TARS for region %u out of bounds", region);
assert(_top_at_rebuild_starts[region] == nullptr,
"TARS for region %u has already been set to " PTR_FORMAT " should be null",
region, p2i(_top_at_rebuild_starts[region]));
G1RemSetTrackingPolicy* tracker = _g1h->policy()->remset_tracker();
if (tracker->needs_scan_for_rebuild(r)) {
_top_at_rebuild_starts[region] = r->top();
} else {
// Leave TARS at null.
}
_top_at_rebuild_starts[region] = r->top();
}
inline void G1CMTask::update_liveness(oop const obj, const size_t obj_size) {

@ -30,14 +30,6 @@
#include "gc/g1/g1RemSetTrackingPolicy.hpp"
#include "runtime/safepoint.hpp"
bool G1RemSetTrackingPolicy::needs_scan_for_rebuild(G1HeapRegion* r) const {
// All non-free and non-young regions need to be scanned for references;
// At every gc we gather references to other regions in young.
// Free regions trivially do not need scanning because they do not contain live
// objects.
return !(r->is_young() || r->is_free());
}
void G1RemSetTrackingPolicy::update_at_allocate(G1HeapRegion* r) {
assert(r->is_young() || r->is_humongous() || r->is_old(),
"Region %u with unexpected heap region type %s", r->hrm_index(), r->get_type_str());

@ -34,9 +34,6 @@
// set is complete.
class G1RemSetTrackingPolicy : public CHeapObj<mtGC> {
public:
// Do we need to scan the given region to get all outgoing references for remembered
// set rebuild?
bool needs_scan_for_rebuild(G1HeapRegion* r) const;
// Update remembered set tracking state at allocation of the region. May be
// called at any time. The caller makes sure that the changes to the remembered
// set state are visible to other threads.