Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8268556: Use bitmap for storing regions that failed evacuation

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1477,7 +1477,7 @@ G1CollectedHeap::G1CollectedHeap() :
_cr(NULL),
_task_queues(NULL),
_num_regions_failed_evacuation(0),
_regions_failed_evacuation(NULL),
_regions_failed_evacuation(mtGC),
_evacuation_failed_info_array(NULL),
_preserved_marks_set(true /* in_c_heap */),
#ifndef PRODUCT
@@ -1770,7 +1770,7 @@ jint G1CollectedHeap::initialize() {

_collection_set.initialize(max_reserved_regions());

_regions_failed_evacuation = NEW_C_HEAP_ARRAY(volatile bool, max_regions(), mtGC);
_regions_failed_evacuation.resize(max_regions());

G1InitLogger::print();

@@ -3470,7 +3470,7 @@ void G1CollectedHeap::pre_evacuate_collection_set(G1EvacuationInfo& evacuation_i
_expand_heap_after_alloc_failure = true;
Atomic::store(&_num_regions_failed_evacuation, 0u);

memset((void*)_regions_failed_evacuation, false, sizeof(bool) * max_regions());
_regions_failed_evacuation.clear();

// Disable the hot card cache.
_hot_card_cache->reset_hot_cache_claimed_index();
@@ -55,6 +55,7 @@
#include "gc/shared/softRefPolicy.hpp"
#include "gc/shared/taskqueue.hpp"
#include "memory/memRegion.hpp"
#include "utilities/bitMap.hpp"
#include "utilities/stack.hpp"

// A "G1CollectedHeap" is an implementation of a java heap for HotSpot.
@@ -868,7 +869,7 @@ class G1CollectedHeap : public CollectedHeap {
// Number of regions evacuation failed in the current collection.
volatile uint _num_regions_failed_evacuation;
// Records for every region on the heap whether evacuation failed for it.
volatile bool* _regions_failed_evacuation;
CHeapBitMap _regions_failed_evacuation;

EvacuationFailedInfo* _evacuation_failed_info_array;

@@ -37,6 +37,7 @@
#include "gc/shared/markBitMap.inline.hpp"
#include "gc/shared/taskqueue.inline.hpp"
#include "runtime/atomic.hpp"
#include "utilities/bitMap.inline.hpp"

G1GCPhaseTimes* G1CollectedHeap::phase_times() const {
return _policy->phase_times();
@@ -195,20 +196,15 @@ bool G1CollectedHeap::evacuation_failed() const {
}

bool G1CollectedHeap::evacuation_failed(uint region_idx) const {
assert(region_idx < max_regions(), "Invalid region index %u", region_idx);

return Atomic::load(&_regions_failed_evacuation[region_idx]);
return _regions_failed_evacuation.par_at(region_idx, memory_order_relaxed);
}

uint G1CollectedHeap::num_regions_failed_evacuation() const {
return Atomic::load(&_num_regions_failed_evacuation);
}

bool G1CollectedHeap::notify_region_failed_evacuation(uint const region_idx) {
assert(region_idx < max_regions(), "Invalid region index %u", region_idx);

volatile bool* region_failed_addr = &_regions_failed_evacuation[region_idx];
bool result = !Atomic::load(region_failed_addr) && !Atomic::cmpxchg(region_failed_addr, false, true, memory_order_relaxed);
bool result = _regions_failed_evacuation.par_set_bit(region_idx, memory_order_relaxed);
if (result) {
Atomic::inc(&_num_regions_failed_evacuation, memory_order_relaxed);
}