In deal_with_reference we have code that looks something like
if (!_nextMarkBitMap->isMarked(objAddr)) {
HeapRegion* hr= _g1h->heap_region_containing_raw(obj);
if (!hr->obj_allocated_since_next_marking(obj)) {
if (_cm->par_mark_and_count(obj, ...)) {
...
Similarly, in grayRoot we have
if (!_nextMarkBitMap->isMarked(addr)) {
par_mark_and_count(obj, ...);
}
But par_mark_and_count calls _nextBitMap->parMark(addr), which calls par_set_bit on the underlying BitMap. And par_set_bit first tests whether the mark bit is already set, avoiding the CAS operation if so.
So the outer tests of the mark bit appear to be unnecessary and just waste time.
if (!_nextMarkBitMap->isMarked(objAddr)) {
HeapRegion* hr= _g1h->heap_region_containing_raw(obj);
if (!hr->obj_allocated_since_next_marking(obj)) {
if (_cm->par_mark_and_count(obj, ...)) {
...
Similarly, in grayRoot we have
if (!_nextMarkBitMap->isMarked(addr)) {
par_mark_and_count(obj, ...);
}
But par_mark_and_count calls _nextBitMap->parMark(addr), which calls par_set_bit on the underlying BitMap. And par_set_bit first tests whether the mark bit is already set, avoiding the CAS operation if so.
So the outer tests of the mark bit appear to be unnecessary and just waste time.
- duplicates
-
JDK-8184348 Merge G1ConcurrentMark::par_mark() and G1ConcurrentMark::grayRoot()
-
- Resolved
-