8152188: Allow CMSBitMapYieldQuantum for BitMap::clear_range and clear_large_range

Let BitMap::clear_large_range call clear_range instead of firing an assert

Reviewed-by: jmasa, jwilhelm
This commit is contained in:
Sangheon Kim 2016-04-05 16:15:53 -07:00
parent 4f0ffb6ce9
commit 7908c3db94
5 changed files with 31 additions and 5 deletions

View File

@ -36,6 +36,7 @@
#include "utilities/defaultStream.hpp"
#if INCLUDE_ALL_GCS
#include "gc/cms/concurrentMarkSweepGeneration.inline.hpp"
#include "gc/g1/g1_globals.hpp"
#include "gc/g1/heapRegionBounds.inline.hpp"
#include "gc/shared/plab.hpp"
@ -507,6 +508,27 @@ Flag::Error CMSWorkQueueDrainThresholdConstraintFunc(uintx value, bool verbose)
return Flag::SUCCESS;
}
Flag::Error CMSBitMapYieldQuantumConstraintFunc(size_t value, bool verbose) {
#if INCLUDE_ALL_GCS
// Skip for current default value.
if (UseConcMarkSweepGC && FLAG_IS_CMDLINE(CMSBitMapYieldQuantum)) {
// CMSBitMapYieldQuantum should be compared with mark bitmap size.
ConcurrentMarkSweepGeneration* cms = (ConcurrentMarkSweepGeneration*)GenCollectedHeap::heap()->old_gen();
size_t bitmap_size = cms->collector()->markBitMap()->sizeInWords();
if (value > bitmap_size) {
CommandLineError::print(verbose,
"CMSBitMapYieldQuantum (" SIZE_FORMAT ") must "
"be less than or equal to bitmap size (" SIZE_FORMAT ") "
"whose size corresponds to the size of old generation of the Java heap\n",
value, bitmap_size);
return Flag::VIOLATES_CONSTRAINT;
}
}
#endif
return Flag::SUCCESS;
}
Flag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose) {
#if INCLUDE_ALL_GCS
if (UseG1GC && FLAG_IS_CMDLINE(MaxGCPauseMillis) && (value >= GCPauseIntervalMillis)) {

View File

@ -64,6 +64,7 @@ Flag::Error CMSPrecleanDenominatorConstraintFunc(uintx value, bool verbose);
Flag::Error CMSPrecleanNumeratorConstraintFunc(uintx value, bool verbose);
Flag::Error CMSSamplingGrainConstraintFunc(uintx value, bool verbose);
Flag::Error CMSWorkQueueDrainThresholdConstraintFunc(uintx value, bool verbose);
Flag::Error CMSBitMapYieldQuantumConstraintFunc(size_t value, bool verbose);
Flag::Error MaxGCPauseMillisConstraintFunc(uintx value, bool verbose);
Flag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose);
Flag::Error InitialBootClassLoaderMetaspaceSizeConstraintFunc(size_t value, bool verbose);

View File

@ -1927,6 +1927,7 @@ public:
"Bitmap operations should process at most this many bits " \
"between yields") \
range(1, max_uintx) \
constraint(CMSBitMapYieldQuantumConstraintFunc,AfterMemoryInit) \
\
product(bool, CMSPrintChunksInDump, false, \
"If logging for the \"gc\" and \"promotion\" tags is enabled on" \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -163,8 +163,10 @@ void BitMap::clear_large_range(idx_t beg, idx_t end) {
idx_t beg_full_word = word_index_round_up(beg);
idx_t end_full_word = word_index(end);
assert(end_full_word - beg_full_word >= 32,
"the range must include at least 32 bytes");
if (end_full_word - beg_full_word < 32) {
clear_range(beg, end);
return;
}
// The range includes at least one full word.
clear_range_within_word(beg, bit_index(beg_full_word));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -93,7 +93,7 @@ inline void BitMap::set_range(idx_t beg, idx_t end, RangeSizeHint hint) {
}
inline void BitMap::clear_range(idx_t beg, idx_t end, RangeSizeHint hint) {
if (hint == small_range && end - beg == 1) {
if (end - beg == 1) {
clear_bit(beg);
} else {
if (hint == large_range) {