8065402: G1 does not expand marking stack when mark stack overflow happens during concurrent marking

Simplified decision mechanism for marking stack expansion

Reviewed-by: kbarrett, tschatzl
This commit is contained in:
Alexander Harlap 2017-05-09 13:50:06 -04:00
parent 72a8ea429e
commit 4dc55a6593
2 changed files with 7 additions and 17 deletions

View File

@ -135,8 +135,7 @@ void G1CMBitMap::clear_range(MemRegion mr) {
G1CMMarkStack::G1CMMarkStack() :
_max_chunk_capacity(0),
_base(NULL),
_chunk_capacity(0),
_should_expand(false) {
_chunk_capacity(0) {
set_empty();
}
@ -159,7 +158,6 @@ bool G1CMMarkStack::resize(size_t new_capacity) {
_base = new_base;
_chunk_capacity = new_capacity;
set_empty();
_should_expand = false;
return true;
}
@ -188,9 +186,6 @@ bool G1CMMarkStack::initialize(size_t initial_capacity, size_t max_capacity) {
}
void G1CMMarkStack::expand() {
// Clear expansion flag
_should_expand = false;
if (_chunk_capacity == _max_chunk_capacity) {
log_debug(gc)("Can not expand overflow mark stack further, already at maximum capacity of " SIZE_FORMAT " chunks.", _chunk_capacity);
return;
@ -590,8 +585,13 @@ void G1ConcurrentMark::reset() {
void G1ConcurrentMark::reset_marking_state() {
_global_mark_stack.set_should_expand(has_overflown());
_global_mark_stack.set_empty();
// Expand the marking stack, if we have to and if we can.
if (has_overflown()) {
_global_mark_stack.expand();
}
clear_has_overflown();
_finger = _heap_start;
@ -1156,11 +1156,6 @@ void G1ConcurrentMark::checkpointRootsFinal(bool clear_all_soft_refs) {
set_non_marking_state();
}
// Expand the marking stack, if we have to and if we can.
if (_global_mark_stack.should_expand()) {
_global_mark_stack.expand();
}
// Statistics
double now = os::elapsedTime();
_remark_mark_times.add((mark_work_end - start) * 1000.0);

View File

@ -259,8 +259,6 @@ private:
TaskQueueEntryChunk* remove_chunk_from_chunk_list();
TaskQueueEntryChunk* remove_chunk_from_free_list();
bool _should_expand;
// Resizes the mark stack to the given new capacity. Releases any previous
// memory if successful.
bool resize(size_t new_capacity);
@ -293,9 +291,6 @@ private:
size_t capacity() const { return _chunk_capacity; }
bool should_expand() const { return _should_expand; }
void set_should_expand(bool value) { _should_expand = value; }
// Expand the stack, typically in response to an overflow condition
void expand();