This commit is contained in:
Thomas Schatzl 2014-08-28 15:55:05 +00:00
commit f12e5848bd
2 changed files with 11 additions and 2 deletions

View File

@ -888,7 +888,16 @@ class CheckBitmapClearHRClosure : public HeapRegionClosure {
}
virtual bool doHeapRegion(HeapRegion* r) {
return _bitmap->getNextMarkedWordAddress(r->bottom(), r->end()) != r->end();
// This closure can be called concurrently to the mutator, so we must make sure
// that the result of the getNextMarkedWordAddress() call is compared to the
// value passed to it as limit to detect any found bits.
// We can use the region's orig_end() for the limit and the comparison value
// as it always contains the "real" end of the region that never changes and
// has no side effects.
// Due to the latter, there can also be no problem with the compiler generating
// reloads of the orig_end() call.
HeapWord* end = r->orig_end();
return _bitmap->getNextMarkedWordAddress(r->bottom(), end) != end;
}
};

View File

@ -566,7 +566,7 @@ class HeapRegion: public G1OffsetTableContigSpace {
void set_next_dirty_cards_region(HeapRegion* hr) { _next_dirty_cards_region = hr; }
bool is_on_dirty_cards_region_list() const { return get_next_dirty_cards_region() != NULL; }
HeapWord* orig_end() { return _orig_end; }
HeapWord* orig_end() const { return _orig_end; }
// Reset HR stuff to default values.
void hr_clear(bool par, bool clear_space, bool locked = false);