提交 73206bcf 编写于 作者: T tschatzl

8048085: Aborting marking just before remark results in useless additional...

8048085: Aborting marking just before remark results in useless additional clearing of the next mark bitmap
Summary: Skip clearing the next bitmap if we just recently aborted since the full GC already clears this bitmap.
Reviewed-by: brutisso
上级 f0e72fd7
...@@ -890,6 +890,10 @@ void ConcurrentMark::clearNextBitmap() { ...@@ -890,6 +890,10 @@ void ConcurrentMark::clearNextBitmap() {
guarantee(!g1h->mark_in_progress(), "invariant"); guarantee(!g1h->mark_in_progress(), "invariant");
} }
bool ConcurrentMark::nextMarkBitmapIsClear() {
return _nextMarkBitMap->getNextMarkedWordAddress(_heap_start, _heap_end) == _heap_end;
}
class NoteStartOfMarkHRClosure: public HeapRegionClosure { class NoteStartOfMarkHRClosure: public HeapRegionClosure {
public: public:
bool doHeapRegion(HeapRegion* r) { bool doHeapRegion(HeapRegion* r) {
...@@ -3362,7 +3366,8 @@ void ConcurrentMark::print_stats() { ...@@ -3362,7 +3366,8 @@ void ConcurrentMark::print_stats() {
// abandon current marking iteration due to a Full GC // abandon current marking iteration due to a Full GC
void ConcurrentMark::abort() { void ConcurrentMark::abort() {
// Clear all marks to force marking thread to do nothing // Clear all marks in the next bitmap for the next marking cycle. This will allow us to skip the next
// concurrent bitmap clearing.
_nextMarkBitMap->clearAll(); _nextMarkBitMap->clearAll();
// Note we cannot clear the previous marking bitmap here // Note we cannot clear the previous marking bitmap here
......
...@@ -736,6 +736,9 @@ public: ...@@ -736,6 +736,9 @@ public:
// Clear the next marking bitmap (will be called concurrently). // Clear the next marking bitmap (will be called concurrently).
void clearNextBitmap(); void clearNextBitmap();
// Return whether the next mark bitmap has no marks set.
bool nextMarkBitmapIsClear();
// These two do the work that needs to be done before and after the // These two do the work that needs to be done before and after the
// initial root checkpoint. Since this checkpoint can be done at two // initial root checkpoint. Since this checkpoint can be done at two
// different points (i.e. an explicit pause or piggy-backed on a // different points (i.e. an explicit pause or piggy-backed on a
......
...@@ -275,9 +275,13 @@ void ConcurrentMarkThread::run() { ...@@ -275,9 +275,13 @@ void ConcurrentMarkThread::run() {
// We now want to allow clearing of the marking bitmap to be // We now want to allow clearing of the marking bitmap to be
// suspended by a collection pause. // suspended by a collection pause.
{ // We may have aborted just before the remark. Do not bother clearing the
// bitmap then, as it has been done during mark abort.
if (!cm()->has_aborted()) {
SuspendibleThreadSetJoiner sts; SuspendibleThreadSetJoiner sts;
_cm->clearNextBitmap(); _cm->clearNextBitmap();
} else {
assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear");
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册