8275381: G1: refactor 2 constructors of G1CardSetConfiguration
Reviewed-by: tschatzl, ayang
This commit is contained in:
parent
5bbe4cae87
commit
5dab76b939
@ -45,51 +45,47 @@
|
||||
G1CardSet::CardSetPtr G1CardSet::FullCardSet = (G1CardSet::CardSetPtr)-1;
|
||||
|
||||
G1CardSetConfiguration::G1CardSetConfiguration() :
|
||||
_inline_ptr_bits_per_card(HeapRegion::LogCardsPerRegion) {
|
||||
G1CardSetConfiguration(HeapRegion::LogCardsPerRegion, /* inline_ptr_bits_per_card */
|
||||
G1RemSetArrayOfCardsEntries, /* num_cards_in_array */
|
||||
(double)G1RemSetCoarsenHowlBitmapToHowlFullPercent / 100, /* cards_in_bitmap_threshold_percent */
|
||||
G1RemSetHowlNumBuckets, /* num_buckets_in_howl */
|
||||
(double)G1RemSetCoarsenHowlToFullPercent / 100, /* cards_in_howl_threshold_percent */
|
||||
(uint)HeapRegion::CardsPerRegion) /* max_cards_in_cardset */
|
||||
{ }
|
||||
|
||||
// Array of Cards card set container size calculation
|
||||
_num_cards_in_array = G1RemSetArrayOfCardsEntries;
|
||||
|
||||
// Full card set container size calculation
|
||||
_max_cards_in_card_set = (uint)HeapRegion::CardsPerRegion;
|
||||
assert(is_power_of_2(_max_cards_in_card_set),
|
||||
"max_cards_in_card_set must be a power of 2: %u", _max_cards_in_card_set);
|
||||
_cards_in_howl_threshold = _max_cards_in_card_set * (double)G1RemSetCoarsenHowlToFullPercent / 100;
|
||||
|
||||
// Howl card set container size calculation.
|
||||
_num_buckets_in_howl = G1RemSetHowlNumBuckets;
|
||||
|
||||
// Howl Bitmap card set container size calculation.
|
||||
_num_cards_in_howl_bitmap = G1CardSetHowl::bitmap_size(_max_cards_in_card_set, _num_buckets_in_howl);
|
||||
_log2_num_cards_in_howl_bitmap = log2i_exact(_num_cards_in_howl_bitmap);
|
||||
_cards_in_howl_bitmap_threshold = _num_cards_in_howl_bitmap * (double)G1RemSetCoarsenHowlBitmapToHowlFullPercent / 100;
|
||||
_bitmap_hash_mask = ~(~(0) << _log2_num_cards_in_howl_bitmap);
|
||||
|
||||
init_card_set_alloc_options();
|
||||
|
||||
log_configuration();
|
||||
}
|
||||
G1CardSetConfiguration::G1CardSetConfiguration(uint num_cards_in_array,
|
||||
double cards_in_bitmap_threshold_percent,
|
||||
uint max_buckets_in_howl,
|
||||
double cards_in_howl_threshold_percent,
|
||||
uint max_cards_in_card_set) :
|
||||
G1CardSetConfiguration(log2i_exact(max_cards_in_card_set), /* inline_ptr_bits_per_card */
|
||||
num_cards_in_array, /* num_cards_in_array */
|
||||
cards_in_bitmap_threshold_percent, /* cards_in_bitmap_threshold_percent */
|
||||
G1CardSetHowl::num_buckets(max_cards_in_card_set, /* num_buckets_in_howl */
|
||||
num_cards_in_array,
|
||||
max_buckets_in_howl),
|
||||
cards_in_howl_threshold_percent, /* cards_in_howl_threshold_percent */
|
||||
max_cards_in_card_set) /* max_cards_in_cardset */
|
||||
{ }
|
||||
|
||||
G1CardSetConfiguration::G1CardSetConfiguration(uint inline_ptr_bits_per_card,
|
||||
uint num_cards_in_array,
|
||||
double cards_in_bitmap_threshold,
|
||||
uint max_buckets_in_howl,
|
||||
double cards_in_howl_threshold,
|
||||
uint max_cards_in_cardset) :
|
||||
double cards_in_bitmap_threshold_percent,
|
||||
uint num_buckets_in_howl,
|
||||
double cards_in_howl_threshold_percent,
|
||||
uint max_cards_in_card_set) :
|
||||
_inline_ptr_bits_per_card(inline_ptr_bits_per_card),
|
||||
_num_cards_in_array(num_cards_in_array),
|
||||
_max_cards_in_card_set(max_cards_in_cardset),
|
||||
_cards_in_howl_threshold(max_cards_in_cardset * cards_in_howl_threshold) {
|
||||
_num_buckets_in_howl(num_buckets_in_howl),
|
||||
_max_cards_in_card_set(max_cards_in_card_set),
|
||||
_cards_in_howl_threshold(max_cards_in_card_set * cards_in_howl_threshold_percent),
|
||||
_num_cards_in_howl_bitmap(G1CardSetHowl::bitmap_size(_max_cards_in_card_set, _num_buckets_in_howl)),
|
||||
_cards_in_howl_bitmap_threshold(_num_cards_in_howl_bitmap * cards_in_bitmap_threshold_percent),
|
||||
_log2_num_cards_in_howl_bitmap(log2i_exact(_num_cards_in_howl_bitmap)),
|
||||
_bitmap_hash_mask(~(~(0) << _log2_num_cards_in_howl_bitmap)) {
|
||||
|
||||
assert(is_power_of_2(_max_cards_in_card_set),
|
||||
"max_cards_in_card_set must be a power of 2: %u", _max_cards_in_card_set);
|
||||
|
||||
_num_buckets_in_howl = G1CardSetHowl::num_buckets(_max_cards_in_card_set, _num_cards_in_array, max_buckets_in_howl);
|
||||
|
||||
_num_cards_in_howl_bitmap = G1CardSetHowl::bitmap_size(_max_cards_in_card_set, _num_buckets_in_howl);
|
||||
_cards_in_howl_bitmap_threshold = _num_cards_in_howl_bitmap * cards_in_bitmap_threshold;
|
||||
_log2_num_cards_in_howl_bitmap = log2i_exact(_num_cards_in_howl_bitmap);
|
||||
_bitmap_hash_mask = ~(~(0) << _log2_num_cards_in_howl_bitmap);
|
||||
"max_cards_in_card_set must be a power of 2: %u", _max_cards_in_card_set);
|
||||
|
||||
init_card_set_alloc_options();
|
||||
|
||||
|
@ -51,16 +51,22 @@ class G1CardSetConfiguration {
|
||||
uint _inline_ptr_bits_per_card;
|
||||
|
||||
uint _num_cards_in_array;
|
||||
uint _num_cards_in_howl_bitmap;
|
||||
uint _num_buckets_in_howl;
|
||||
uint _max_cards_in_card_set;
|
||||
uint _cards_in_howl_threshold;
|
||||
uint _num_cards_in_howl_bitmap;
|
||||
uint _cards_in_howl_bitmap_threshold;
|
||||
uint _log2_num_cards_in_howl_bitmap;
|
||||
size_t _bitmap_hash_mask;
|
||||
|
||||
G1CardSetAllocOptions* _card_set_alloc_options;
|
||||
|
||||
G1CardSetConfiguration(uint inline_ptr_bits_per_card,
|
||||
uint num_cards_in_array,
|
||||
double cards_in_bitmap_threshold_percent,
|
||||
uint num_buckets_in_howl,
|
||||
double cards_in_howl_threshold_percent,
|
||||
uint max_cards_in_card_set);
|
||||
void init_card_set_alloc_options();
|
||||
|
||||
void log_configuration();
|
||||
@ -69,12 +75,12 @@ public:
|
||||
// Initialize card set configuration from globals.
|
||||
G1CardSetConfiguration();
|
||||
// Initialize card set configuration from parameters.
|
||||
G1CardSetConfiguration(uint inline_ptr_bits_per_card,
|
||||
uint num_cards_in_array,
|
||||
double cards_in_bitmap_threshold,
|
||||
// Only for test
|
||||
G1CardSetConfiguration(uint num_cards_in_array,
|
||||
double cards_in_bitmap_threshold_percent,
|
||||
uint max_buckets_in_howl,
|
||||
double cards_in_howl_threshold,
|
||||
uint max_cards_in_cardset);
|
||||
double cards_in_howl_threshold_percent,
|
||||
uint max_cards_in_card_set);
|
||||
|
||||
~G1CardSetConfiguration();
|
||||
|
||||
|
@ -206,7 +206,11 @@ void G1CardSetTest::cardset_basic_test() {
|
||||
const double FullCardSetThreshold = 0.8;
|
||||
const double BitmapCoarsenThreshold = 0.9;
|
||||
|
||||
G1CardSetConfiguration config(log2i_exact(CardsPerRegion), 28, BitmapCoarsenThreshold, 8, FullCardSetThreshold, CardsPerRegion);
|
||||
G1CardSetConfiguration config(28,
|
||||
BitmapCoarsenThreshold,
|
||||
8,
|
||||
FullCardSetThreshold,
|
||||
CardsPerRegion);
|
||||
G1CardSetFreePool free_pool(config.num_mem_object_types());
|
||||
G1CardSetMemoryManager mm(&config, &free_pool);
|
||||
|
||||
@ -420,7 +424,11 @@ void G1CardSetTest::cardset_mt_test() {
|
||||
const double FullCardSetThreshold = 1.0;
|
||||
const uint BitmapCoarsenThreshold = 1.0;
|
||||
|
||||
G1CardSetConfiguration config(log2i_exact(CardsPerRegion), 120, BitmapCoarsenThreshold, 8, FullCardSetThreshold, CardsPerRegion);
|
||||
G1CardSetConfiguration config(120,
|
||||
BitmapCoarsenThreshold,
|
||||
8,
|
||||
FullCardSetThreshold,
|
||||
CardsPerRegion);
|
||||
G1CardSetFreePool free_pool(config.num_mem_object_types());
|
||||
G1CardSetMemoryManager mm(&config, &free_pool);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user