8165858: heapRegionManager is missing volatile specifier for _claims

Added volatile specifier.

Reviewed-by: kbarrett, tschatzl
This commit is contained in:
Erik Österlund 2016-09-24 16:02:29 -04:00
parent c0c4200524
commit 1d00efa1c6
2 changed files with 6 additions and 6 deletions

View File

@ -482,8 +482,9 @@ void HeapRegionManager::verify_optional() {
HeapRegionClaimer::HeapRegionClaimer(uint n_workers) :
_n_workers(n_workers), _n_regions(G1CollectedHeap::heap()->_hrm._allocated_heapregions_length), _claims(NULL) {
assert(n_workers > 0, "Need at least one worker.");
_claims = NEW_C_HEAP_ARRAY(uint, _n_regions, mtGC);
memset(_claims, Unclaimed, sizeof(*_claims) * _n_regions);
uint* new_claims = NEW_C_HEAP_ARRAY(uint, _n_regions, mtGC);
memset(new_claims, Unclaimed, sizeof(*_claims) * _n_regions);
_claims = new_claims;
}
HeapRegionClaimer::~HeapRegionClaimer() {

View File

@ -259,9 +259,9 @@ public:
// The HeapRegionClaimer is used during parallel iteration over heap regions,
// allowing workers to claim heap regions, gaining exclusive rights to these regions.
class HeapRegionClaimer : public StackObj {
uint _n_workers;
uint _n_regions;
uint* _claims;
uint _n_workers;
uint _n_regions;
volatile uint* _claims;
static const uint Unclaimed = 0;
static const uint Claimed = 1;
@ -285,4 +285,3 @@ class HeapRegionClaimer : public StackObj {
bool claim_region(uint region_index);
};
#endif // SHARE_VM_GC_G1_HEAPREGIONMANAGER_HPP