--- old/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp 2016-03-29 11:56:35.802007312 -0700 +++ new/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp 2016-03-29 11:56:35.658007317 -0700 @@ -386,21 +386,21 @@ #if INCLUDE_ALL_GCS if (UseConcMarkSweepGC) { // ParGCCardsPerStrideChunk shoule be compared with card table size. - // As CardTableModRefBS::_last_valid_index is 'protected', calculate it in a same way. size_t heap_size = Universe::heap()->reserved_region().word_size(); - size_t card_table_size = align_size_up(heap_size, CardTableModRefBS::card_size_in_words); - card_table_size /= (CardTableModRefBS::card_size_in_words + 1); - card_table_size -= 1; + CardTableModRefBS* bs = (CardTableModRefBS*)GenCollectedHeap::heap()->rem_set()->bs(); + size_t card_table_size = bs->cards_required(heap_size) - 1; // Valid card table size if ((size_t)value > card_table_size) { CommandLineError::print(verbose, - "ParGCCardsPerStrideChunk (" INTX_FORMAT ") must be " - "less than or equal to card table size (" SIZE_FORMAT ")\n", + "ParGCCardsPerStrideChunk (" INTX_FORMAT ") is too large for the heap size and " + "must be less than or equal to card table size (" SIZE_FORMAT ")\n", value, card_table_size); return Flag::VIOLATES_CONSTRAINT; } - // If n_strides which is used with ParGCCardsPerStrideChunk is really large, we would face an overflow. + // ParGCCardsPerStrideChunk is used with n_strides(ParallelGCThreads*ParGCStridesPerThread) + // from CardTableModRefBSForCTRS::process_stride(). However, ParGCStridesPerThread is already checked + // not to make an overflow with ParallelGCThreads from its constraint function. uintx n_strides = ParallelGCThreads * ParGCStridesPerThread; uintx ergo_max = max_uintx / n_strides; if ((uintx)value > ergo_max) {