--- a/hotspot/src/share/vm/gc/shared/cardTableModRefBS.hpp Fri Apr 01 14:30:10 2016 -0700
+++ b/hotspot/src/share/vm/gc/shared/cardTableModRefBS.hpp Fri Apr 01 14:34:17 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -89,14 +89,6 @@
MemRegion _guard_region;
protected:
- // Initialization utilities; covered_words is the size of the covered region
- // in, um, words.
- inline size_t cards_required(size_t covered_words) {
- // Add one for a guard card, used to detect errors.
- const size_t words = align_size_up(covered_words, card_size_in_words);
- return words / card_size_in_words + 1;
- }
-
inline size_t compute_byte_map_size();
// Finds and return the index of the region, if any, to which the given
@@ -172,6 +164,14 @@
bool has_write_ref_pre_barrier() { return false; }
+ // Initialization utilities; covered_words is the size of the covered region
+ // in, um, words.
+ inline size_t cards_required(size_t covered_words) {
+ // Add one for a guard card, used to detect errors.
+ const size_t words = align_size_up(covered_words, card_size_in_words);
+ return words / card_size_in_words + 1;
+ }
+
protected:
CardTableModRefBS(MemRegion whole_heap, const BarrierSet::FakeRtti& fake_rtti);
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp Fri Apr 01 14:30:10 2016 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.cpp Fri Apr 01 14:34:17 2016 -0700
@@ -114,7 +114,7 @@
static Flag::Error MinPLABSizeBounds(const char* name, size_t value, bool verbose) {
#if INCLUDE_ALL_GCS
- if ((UseConcMarkSweepGC || UseG1GC) && (value < PLAB::min_size())) {
+ if ((UseConcMarkSweepGC || UseG1GC || UseParallelGC) && (value < PLAB::min_size())) {
CommandLineError::print(verbose,
"%s (" SIZE_FORMAT ") must be "
"greater than or equal to ergonomic PLAB minimum size (" SIZE_FORMAT ")\n",
@@ -127,7 +127,7 @@
static Flag::Error MaxPLABSizeBounds(const char* name, size_t value, bool verbose) {
#if INCLUDE_ALL_GCS
- if ((UseConcMarkSweepGC || UseG1GC) && (value > PLAB::max_size())) {
+ if ((UseConcMarkSweepGC || UseG1GC || UseParallelGC) && (value > PLAB::max_size())) {
CommandLineError::print(verbose,
"%s (" SIZE_FORMAT ") must be "
"less than or equal to ergonomic PLAB maximum size (" SIZE_FORMAT ")\n",
@@ -382,6 +382,39 @@
return Flag::SUCCESS;
}
+Flag::Error ParGCCardsPerStrideChunkConstraintFunc(intx value, bool verbose) {
+#if INCLUDE_ALL_GCS
+ if (UseConcMarkSweepGC) {
+ // ParGCCardsPerStrideChunk should be compared with card table size.
+ size_t heap_size = Universe::heap()->reserved_region().word_size();
+ 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 ") 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;
+ }
+
+ // ParGCCardsPerStrideChunk is used with n_strides(ParallelGCThreads*ParGCStridesPerThread)
+ // from CardTableModRefBSForCTRS::process_stride(). Note that 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) {
+ CommandLineError::print(verbose,
+ "ParGCCardsPerStrideChunk (" INTX_FORMAT ") must be "
+ "less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n",
+ value, ergo_max);
+ return Flag::VIOLATES_CONSTRAINT;
+ }
+ }
+#endif
+ return Flag::SUCCESS;
+}
+
Flag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose) {
Flag::Error status = Flag::SUCCESS;
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.hpp Fri Apr 01 14:30:10 2016 -0700
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsGC.hpp Fri Apr 01 14:34:17 2016 -0700
@@ -56,6 +56,7 @@
#endif // INCLUDE_ALL_GCS
Flag::Error ParGCStridesPerThreadConstraintFunc(uintx value, bool verbose);
+Flag::Error ParGCCardsPerStrideChunkConstraintFunc(intx value, bool verbose);
Flag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose);
Flag::Error CMSOldPLABMaxConstraintFunc(size_t value, bool verbose);
Flag::Error MarkStackSizeConstraintFunc(size_t value, bool verbose);
--- a/hotspot/src/share/vm/runtime/globals.hpp Fri Apr 01 14:30:10 2016 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp Fri Apr 01 14:34:17 2016 -0700
@@ -1629,6 +1629,7 @@
"The number of cards in each chunk of the parallel chunks used " \
"during card table scanning") \
range(1, max_intx) \
+ constraint(ParGCCardsPerStrideChunkConstraintFunc,AfterMemoryInit)\
\
product(uintx, OldPLABWeight, 50, \
"Percentage (0-100) used to weight the current sample when " \