8065972: Remove support for ParNew+SerialOld and DefNew+CMS
Reviewed-by: mgerdin, stefank
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp Thu Nov 27 21:02:13 2014 +0100
@@ -52,21 +52,9 @@
}
void ConcurrentMarkSweepPolicy::initialize_generations() {
- _generations = NEW_C_HEAP_ARRAY3(GenerationSpecPtr, number_of_generations(), mtGC,
- CURRENT_PC, AllocFailStrategy::RETURN_NULL);
- if (_generations == NULL)
- vm_exit_during_initialization("Unable to allocate gen spec");
-
- Generation::Name yg_name =
- UseParNewGC ? Generation::ParNew : Generation::DefNew;
- _generations[0] = new GenerationSpec(yg_name, _initial_young_size,
- _max_young_size);
- _generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep,
- _initial_old_size, _max_old_size);
-
- if (_generations[0] == NULL || _generations[1] == NULL) {
- vm_exit_during_initialization("Unable to allocate gen spec");
- }
+ _generations = NEW_C_HEAP_ARRAY(GenerationSpecPtr, number_of_generations(), mtGC);
+ _generations[0] = new GenerationSpec(Generation::ParNew, _initial_young_size, _max_young_size);
+ _generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep, _initial_old_size, _max_old_size);
}
void ConcurrentMarkSweepPolicy::initialize_size_policy(size_t init_eden_size,
@@ -82,10 +70,5 @@
void ConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
// initialize the policy counters - 2 collectors, 3 generations
- if (UseParNewGC) {
- _gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
- }
- else {
- _gc_policy_counters = new GCPolicyCounters("Copy:CMS", 2, 3);
- }
+ _gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
}
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Thu Nov 27 21:02:13 2014 +0100
@@ -4094,10 +4094,7 @@
}
if (clean_survivor) { // preclean the active survivor space(s)
- assert(_young_gen->kind() == Generation::DefNew ||
- _young_gen->kind() == Generation::ParNew,
- "incorrect type for cast");
- DefNewGeneration* dng = (DefNewGeneration*)_young_gen;
+ DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
PushAndMarkClosure pam_cl(this, _span, ref_processor(),
&_markBitMap, &_modUnionTable,
&_markStack, true /* precleaning phase */);
@@ -5168,7 +5165,7 @@
CMSCollector::
initialize_sequential_subtasks_for_young_gen_rescan(int n_threads) {
assert(n_threads > 0, "Unexpected n_threads argument");
- DefNewGeneration* dng = (DefNewGeneration*)_young_gen;
+ DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
// Eden space
if (!dng->eden()->is_empty()) {
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Thu Nov 27 21:02:13 2014 +0100
@@ -1256,8 +1256,6 @@
virtual const char* short_name() const { return "CMS"; }
void print() const;
void printOccupancy(const char* s);
- bool must_be_youngest() const { return false; }
- bool must_be_oldest() const { return true; }
// Resize the generation after a compacting GC. The
// generation can be treated as a contiguous space
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp Thu Nov 27 21:02:13 2014 +0100
@@ -372,7 +372,6 @@
// override
virtual bool refs_discovery_is_mt() const {
- assert(UseParNewGC, "ParNewGeneration only when UseParNewGC");
return ParallelGCThreads > 1;
}
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp Thu Nov 27 21:02:13 2014 +0100
@@ -283,14 +283,14 @@
// Convert the assertion check to a warning if we are running
// CMS+ParNew until related bug is fixed.
MemRegion ur = sp->used_region();
- assert(ur.contains(urasm) || (UseConcMarkSweepGC && UseParNewGC),
+ assert(ur.contains(urasm) || (UseConcMarkSweepGC),
err_msg("Did you forget to call save_marks()? "
"[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
"[" PTR_FORMAT ", " PTR_FORMAT ")",
p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end())));
// In the case of CMS+ParNew, issue a warning
if (!ur.contains(urasm)) {
- assert(UseConcMarkSweepGC && UseParNewGC, "Tautology: see assert above");
+ assert(UseConcMarkSweepGC, "Tautology: see assert above");
warning("CMS+ParNew: Did you forget to call save_marks()? "
"[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
"[" PTR_FORMAT ", " PTR_FORMAT ")",
@@ -609,21 +609,3 @@
_ct_bs->verify();
}
}
-
-
-void CardTableRS::verify_aligned_region_empty(MemRegion mr) {
- if (!mr.is_empty()) {
- jbyte* cur_entry = byte_for(mr.start());
- jbyte* limit = byte_after(mr.last());
- // The region mr may not start on a card boundary so
- // the first card may reflect a write to the space
- // just prior to mr.
- if (!is_aligned(mr.start())) {
- cur_entry++;
- }
- for (;cur_entry < limit; cur_entry++) {
- guarantee(*cur_entry == CardTableModRefBS::clean_card,
- "Unexpected dirty card found");
- }
- }
-}
--- a/hotspot/src/share/vm/memory/cardTableRS.hpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/memory/cardTableRS.hpp Thu Nov 27 21:02:13 2014 +0100
@@ -138,7 +138,6 @@
}
void verify();
- void verify_aligned_region_empty(MemRegion mr);
void clear(MemRegion mr) { _ct_bs->clear(mr); }
void clear_into_younger(Generation* old_gen);
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp Thu Nov 27 21:02:13 2014 +0100
@@ -908,31 +908,14 @@
}
void MarkSweepPolicy::initialize_generations() {
- _generations = NEW_C_HEAP_ARRAY3(GenerationSpecPtr, number_of_generations(), mtGC, CURRENT_PC,
- AllocFailStrategy::RETURN_NULL);
- if (_generations == NULL) {
- vm_exit_during_initialization("Unable to allocate gen spec");
- }
-
- if (UseParNewGC) {
- _generations[0] = new GenerationSpec(Generation::ParNew, _initial_young_size, _max_young_size);
- } else {
- _generations[0] = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size);
- }
+ _generations = NEW_C_HEAP_ARRAY(GenerationSpecPtr, number_of_generations(), mtGC);
+ _generations[0] = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size);
_generations[1] = new GenerationSpec(Generation::MarkSweepCompact, _initial_old_size, _max_old_size);
-
- if (_generations[0] == NULL || _generations[1] == NULL) {
- vm_exit_during_initialization("Unable to allocate gen spec");
- }
}
void MarkSweepPolicy::initialize_gc_policy_counters() {
// Initialize the policy counters - 2 collectors, 3 generations.
- if (UseParNewGC) {
- _gc_policy_counters = new GCPolicyCounters("ParNew:MSC", 2, 3);
- } else {
- _gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 3);
- }
+ _gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 3);
}
/////////////// Unit tests ///////////////
--- a/hotspot/src/share/vm/memory/defNewGeneration.hpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp Thu Nov 27 21:02:13 2014 +0100
@@ -340,9 +340,6 @@
virtual const char* name() const;
virtual const char* short_name() const { return "DefNew"; }
- bool must_be_youngest() const { return true; }
- bool must_be_oldest() const { return false; }
-
// PrintHeapAtGC support.
void print_on(outputStream* st) const;
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp Thu Nov 27 21:02:13 2014 +0100
@@ -182,10 +182,7 @@
SharedHeap::post_initialize();
GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
guarantee(policy->is_generation_policy(), "Illegal policy type");
- DefNewGeneration* def_new_gen = (DefNewGeneration*) get_gen(0);
- assert(def_new_gen->kind() == Generation::DefNew ||
- def_new_gen->kind() == Generation::ParNew,
- "Wrong generation kind");
+ DefNewGeneration* def_new_gen = get_gen(0)->as_DefNewGeneration();
Generation* old_gen = get_gen(1);
assert(old_gen->kind() == Generation::ConcurrentMarkSweep ||
@@ -1117,10 +1114,8 @@
void GenCollectedHeap::print_gc_threads_on(outputStream* st) const {
#if INCLUDE_ALL_GCS
- if (UseParNewGC) {
+ if (UseConcMarkSweepGC) {
workers()->print_worker_threads_on(st);
- }
- if (UseConcMarkSweepGC) {
ConcurrentMarkSweepThread::print_all_on(st);
}
#endif // INCLUDE_ALL_GCS
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp Thu Nov 27 21:02:13 2014 +0100
@@ -262,12 +262,12 @@
// We don't need barriers for stores to objects in the
// young gen and, a fortiori, for initializing stores to
- // objects therein. This applies to {DefNew,ParNew}+{Tenured,CMS}
+ // objects therein. This applies to DefNew+Tenured and ParNew+CMS
// only and may need to be re-examined in case other
// kinds of collectors are implemented in the future.
virtual bool can_elide_initializing_store_barrier(oop new_obj) {
// We wanted to assert that:-
- // assert(UseParNewGC || UseSerialGC || UseConcMarkSweepGC,
+ // assert(UseSerialGC || UseConcMarkSweepGC,
// "Check can_elide_initializing_store_barrier() for this collector");
// but unfortunately the flag UseSerialGC need not necessarily always
// be set when DefNew+Tenured are being used.
--- a/hotspot/src/share/vm/memory/genRemSet.hpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/memory/genRemSet.hpp Thu Nov 27 21:02:13 2014 +0100
@@ -105,17 +105,6 @@
virtual void verify() = 0;
- // Verify that the remembered set has no entries for
- // the heap interval denoted by mr. If there are any
- // alignment constraints on the remembered set, only the
- // part of the region that is aligned is checked.
- //
- // alignment boundaries
- // +--------+-------+--------+-------+
- // [ region mr )
- // [ part checked )
- virtual void verify_aligned_region_empty(MemRegion mr) = 0;
-
// If appropriate, print some information about the remset on "tty".
virtual void print() {}
--- a/hotspot/src/share/vm/memory/generation.hpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/memory/generation.hpp Thu Nov 27 21:02:13 2014 +0100
@@ -517,13 +517,6 @@
int level() const { return _level; }
- // Attributes
-
- // True iff the given generation may only be the youngest generation.
- virtual bool must_be_youngest() const = 0;
- // True iff the given generation may only be the oldest generation.
- virtual bool must_be_oldest() const = 0;
-
// Reference Processing accessor
ReferenceProcessor* const ref_processor() { return _ref_processor; }
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp Thu Nov 27 21:02:13 2014 +0100
@@ -68,9 +68,7 @@
vm_exit_during_initialization("Failed necessary allocation.");
}
_sh = this; // ch is static, should be set only once.
- if (UseParNewGC ||
- UseG1GC ||
- (UseConcMarkSweepGC && (CMSParallelInitialMarkEnabled || CMSParallelRemarkEnabled) && use_parallel_gc_threads())) {
+ if (UseConcMarkSweepGC || UseG1GC) {
_workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads,
/* are_GC_task_threads */true,
/* are_ConcurrentGC_threads */false);
--- a/hotspot/src/share/vm/memory/tenuredGeneration.cpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.cpp Thu Nov 27 21:02:13 2014 +0100
@@ -64,46 +64,13 @@
_space_counters = new CSpaceCounters(gen_name, 0,
_virtual_space.reserved_size(),
_the_space, _gen_counters);
-#if INCLUDE_ALL_GCS
- if (UseParNewGC) {
- typedef ParGCAllocBufferWithBOT* ParGCAllocBufferWithBOTPtr;
- _alloc_buffers = NEW_C_HEAP_ARRAY(ParGCAllocBufferWithBOTPtr,
- ParallelGCThreads, mtGC);
- if (_alloc_buffers == NULL)
- vm_exit_during_initialization("Could not allocate alloc_buffers");
- for (uint i = 0; i < ParallelGCThreads; i++) {
- _alloc_buffers[i] =
- new ParGCAllocBufferWithBOT(OldPLABSize, _bts);
- if (_alloc_buffers[i] == NULL)
- vm_exit_during_initialization("Could not allocate alloc_buffers");
- }
- } else {
- _alloc_buffers = NULL;
- }
-#endif // INCLUDE_ALL_GCS
-}
-
-
-const char* TenuredGeneration::name() const {
- return "tenured generation";
}
void TenuredGeneration::gc_prologue(bool full) {
_capacity_at_prologue = capacity();
_used_at_prologue = used();
- if (VerifyBeforeGC) {
- verify_alloc_buffers_clean();
- }
}
-void TenuredGeneration::gc_epilogue(bool full) {
- if (VerifyAfterGC) {
- verify_alloc_buffers_clean();
- }
- OneContigSpaceCardGeneration::gc_epilogue(full);
-}
-
-
bool TenuredGeneration::should_collect(bool full,
size_t size,
bool is_tlab) {
@@ -149,15 +116,6 @@
return result;
}
-void TenuredGeneration::collect(bool full,
- bool clear_all_soft_refs,
- size_t size,
- bool is_tlab) {
- retire_alloc_buffers_before_full_gc();
- OneContigSpaceCardGeneration::collect(full, clear_all_soft_refs,
- size, is_tlab);
-}
-
void TenuredGeneration::compute_new_size() {
assert_locked_or_safepoint(Heap_lock);
@@ -171,6 +129,7 @@
err_msg("used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT
" capacity: " SIZE_FORMAT, used(), used_after_gc, capacity()));
}
+
void TenuredGeneration::update_gc_stats(int current_level,
bool full) {
// If the next lower level(s) has been collected, gather any statistics
@@ -198,96 +157,6 @@
}
}
-
-#if INCLUDE_ALL_GCS
-oop TenuredGeneration::par_promote(int thread_num,
- oop old, markOop m, size_t word_sz) {
-
- ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num];
- HeapWord* obj_ptr = buf->allocate(word_sz);
- bool is_lab = true;
- if (obj_ptr == NULL) {
-#ifndef PRODUCT
- if (Universe::heap()->promotion_should_fail()) {
- return NULL;
- }
-#endif // #ifndef PRODUCT
-
- // Slow path:
- if (word_sz * 100 < ParallelGCBufferWastePct * buf->word_sz()) {
- // Is small enough; abandon this buffer and start a new one.
- size_t buf_size = buf->word_sz();
- HeapWord* buf_space =
- TenuredGeneration::par_allocate(buf_size, false);
- if (buf_space == NULL) {
- buf_space = expand_and_allocate(buf_size, false, true /* parallel*/);
- }
- if (buf_space != NULL) {
- buf->retire(false, false);
- buf->set_buf(buf_space);
- obj_ptr = buf->allocate(word_sz);
- assert(obj_ptr != NULL, "Buffer was definitely big enough...");
- }
- };
- // Otherwise, buffer allocation failed; try allocating object
- // individually.
- if (obj_ptr == NULL) {
- obj_ptr = TenuredGeneration::par_allocate(word_sz, false);
- if (obj_ptr == NULL) {
- obj_ptr = expand_and_allocate(word_sz, false, true /* parallel */);
- }
- }
- if (obj_ptr == NULL) return NULL;
- }
- assert(obj_ptr != NULL, "program logic");
- Copy::aligned_disjoint_words((HeapWord*)old, obj_ptr, word_sz);
- oop obj = oop(obj_ptr);
- // Restore the mark word copied above.
- obj->set_mark(m);
- return obj;
-}
-
-void TenuredGeneration::par_promote_alloc_undo(int thread_num,
- HeapWord* obj,
- size_t word_sz) {
- ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num];
- if (buf->contains(obj)) {
- guarantee(buf->contains(obj + word_sz - 1),
- "should contain whole object");
- buf->undo_allocation(obj, word_sz);
- } else {
- CollectedHeap::fill_with_object(obj, word_sz);
- }
-}
-
-void TenuredGeneration::par_promote_alloc_done(int thread_num) {
- ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num];
- buf->retire(true, ParallelGCRetainPLAB);
-}
-
-void TenuredGeneration::retire_alloc_buffers_before_full_gc() {
- if (UseParNewGC) {
- for (uint i = 0; i < ParallelGCThreads; i++) {
- _alloc_buffers[i]->retire(true /*end_of_gc*/, false /*retain*/);
- }
- }
-}
-
-// Verify that any retained parallel allocation buffers do not
-// intersect with dirty cards.
-void TenuredGeneration::verify_alloc_buffers_clean() {
- if (UseParNewGC) {
- for (uint i = 0; i < ParallelGCThreads; i++) {
- _rs->verify_aligned_region_empty(_alloc_buffers[i]->range());
- }
- }
-}
-
-#else // INCLUDE_ALL_GCS
-void TenuredGeneration::retire_alloc_buffers_before_full_gc() {}
-void TenuredGeneration::verify_alloc_buffers_clean() {}
-#endif // INCLUDE_ALL_GCS
-
bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
size_t available = max_contiguous_available();
size_t av_promo = (size_t)gc_stats()->avg_promoted()->padded_average();
--- a/hotspot/src/share/vm/memory/tenuredGeneration.hpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.hpp Thu Nov 27 21:02:13 2014 +0100
@@ -33,22 +33,9 @@
// TenuredGeneration models the heap containing old (promoted/tenured) objects.
-class ParGCAllocBufferWithBOT;
-
class TenuredGeneration: public OneContigSpaceCardGeneration {
friend class VMStructs;
protected:
-
-#if INCLUDE_ALL_GCS
- // To support parallel promotion: an array of parallel allocation
- // buffers, one per thread, initially NULL.
- ParGCAllocBufferWithBOT** _alloc_buffers;
-#endif // INCLUDE_ALL_GCS
-
- // Retire all alloc buffers before a full GC, so that they will be
- // re-allocated at the start of the next young GC.
- void retire_alloc_buffers_before_full_gc();
-
GenerationCounters* _gen_counters;
CSpaceCounters* _space_counters;
@@ -59,10 +46,8 @@
Generation::Name kind() { return Generation::MarkSweepCompact; }
// Printing
- const char* name() const;
+ const char* name() const { return "tenured generation"; }
const char* short_name() const { return "Tenured"; }
- bool must_be_youngest() const { return false; }
- bool must_be_oldest() const { return true; }
// Does a "full" (forced) collection invoked on this generation collect
// all younger generations as well? Note that this is a
@@ -73,26 +58,12 @@
}
virtual void gc_prologue(bool full);
- virtual void gc_epilogue(bool full);
bool should_collect(bool full,
size_t word_size,
bool is_tlab);
- virtual void collect(bool full,
- bool clear_all_soft_refs,
- size_t size,
- bool is_tlab);
virtual void compute_new_size();
-#if INCLUDE_ALL_GCS
- // Overrides.
- virtual oop par_promote(int thread_num,
- oop obj, markOop m, size_t word_sz);
- virtual void par_promote_alloc_undo(int thread_num,
- HeapWord* obj, size_t word_sz);
- virtual void par_promote_alloc_done(int thread_num);
-#endif // INCLUDE_ALL_GCS
-
// Performance Counter support
void update_counters();
@@ -101,8 +72,6 @@
virtual void update_gc_stats(int level, bool full);
virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const;
-
- void verify_alloc_buffers_clean();
};
#endif // SHARE_VM_MEMORY_TENUREDGENERATION_HPP
--- a/hotspot/src/share/vm/oops/oop.inline.hpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp Thu Nov 27 21:02:13 2014 +0100
@@ -441,12 +441,12 @@
s = (int)((size_t)round_to(size_in_bytes, MinObjAlignmentInBytes) /
HeapWordSize);
- // UseParNewGC, UseParallelGC and UseG1GC can change the length field
+ // ParNew (used by CMS), UseParallelGC and UseG1GC can change the length field
// of an "old copy" of an object array in the young gen so it indicates
// the grey portion of an already copied array. This will cause the first
// disjunct below to fail if the two comparands are computed across such
// a concurrent change.
- // UseParNewGC also runs with promotion labs (which look like int
+ // ParNew also runs with promotion labs (which look like int
// filler arrays) which are subject to changing their declared size
// when finally retiring a PLAB; this also can cause the first disjunct
// to fail for another worker thread that is concurrently walking the block
@@ -458,8 +458,8 @@
// technique, we will need to suitably modify the assertion.
assert((s == klass->oop_size(this)) ||
(Universe::heap()->is_gc_active() &&
- ((is_typeArray() && UseParNewGC) ||
- (is_objArray() && is_forwarded() && (UseParNewGC || UseParallelGC || UseG1GC)))),
+ ((is_typeArray() && UseConcMarkSweepGC) ||
+ (is_objArray() && is_forwarded() && (UseConcMarkSweepGC || UseParallelGC || UseG1GC)))),
"wrong array object size");
} else {
// Must be zero, so bite the bullet and take the virtual call.
--- a/hotspot/src/share/vm/runtime/arguments.cpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Thu Nov 27 21:02:13 2014 +0100
@@ -1260,10 +1260,8 @@
void Arguments::set_parnew_gc_flags() {
assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
"control point invariant");
- assert(UseParNewGC, "Error");
-
- // Turn off AdaptiveSizePolicy for parnew until it is complete.
- disable_adaptive_size_policy("UseParNewGC");
+ assert(UseConcMarkSweepGC, "CMS is expected to be on here");
+ assert(UseParNewGC, "ParNew should always be used with CMS");
if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
@@ -1304,21 +1302,12 @@
void Arguments::set_cms_and_parnew_gc_flags() {
assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error");
assert(UseConcMarkSweepGC, "CMS is expected to be on here");
-
- // If we are using CMS, we prefer to UseParNewGC,
- // unless explicitly forbidden.
- if (FLAG_IS_DEFAULT(UseParNewGC)) {
- FLAG_SET_ERGO(bool, UseParNewGC, true);
- }
+ assert(UseParNewGC, "ParNew should always be used with CMS");
// Turn off AdaptiveSizePolicy by default for cms until it is complete.
disable_adaptive_size_policy("UseConcMarkSweepGC");
- // In either case, adjust ParallelGCThreads and/or UseParNewGC
- // as needed.
- if (UseParNewGC) {
- set_parnew_gc_flags();
- }
+ set_parnew_gc_flags();
size_t max_heap = align_size_down(MaxHeapSize,
CardTableRS::ct_max_alignment_constraint());
@@ -1788,14 +1777,11 @@
// Set per-collector flags
if (UseParallelGC || UseParallelOldGC) {
set_parallel_gc_flags();
- } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
+ } else if (UseConcMarkSweepGC) {
set_cms_and_parnew_gc_flags();
- } else if (UseParNewGC) { // Skipped if CMS is set above
- set_parnew_gc_flags();
} else if (UseG1GC) {
set_g1_gc_flags();
}
- check_deprecated_gcs();
check_deprecated_gc_flags();
if (AssumeMP && !UseSerialGC) {
if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
@@ -2156,17 +2142,11 @@
// Check consistency of GC selection
bool Arguments::check_gc_consistency_user() {
check_gclog_consistency();
- bool status = true;
// Ensure that the user has not selected conflicting sets
- // of collectors. [Note: this check is merely a user convenience;
- // collectors over-ride each other so that only a non-conflicting
- // set is selected; however what the user gets is not what they
- // may have expected from the combination they asked for. It's
- // better to reduce user confusion by not allowing them to
- // select conflicting combinations.
+ // of collectors.
uint i = 0;
if (UseSerialGC) i++;
- if (UseConcMarkSweepGC || UseParNewGC) i++;
+ if (UseConcMarkSweepGC) i++;
if (UseParallelGC || UseParallelOldGC) i++;
if (UseG1GC) i++;
if (i > 1) {
@@ -2174,26 +2154,30 @@
"Conflicting collector combinations in option list; "
"please refer to the release notes for the combinations "
"allowed\n");
- status = false;
+ return false;
}
- return status;
-}
-
-void Arguments::check_deprecated_gcs() {
+
if (UseConcMarkSweepGC && !UseParNewGC) {
- warning("Using the DefNew young collector with the CMS collector is deprecated "
- "and will likely be removed in a future release");
+ jio_fprintf(defaultStream::error_stream(),
+ "It is not possible to combine the DefNew young collector with the CMS collector.\n");
+ return false;
}
if (UseParNewGC && !UseConcMarkSweepGC) {
// !UseConcMarkSweepGC means that we are using serial old gc. Unfortunately we don't
// set up UseSerialGC properly, so that can't be used in the check here.
- warning("Using the ParNew young collector with the Serial old collector is deprecated "
- "and will likely be removed in a future release");
+ jio_fprintf(defaultStream::error_stream(),
+ "It is not possible to combine the ParNew young collector with the Serial old collector.\n");
+ return false;
}
+
+ return true;
}
void Arguments::check_deprecated_gc_flags() {
+ if (FLAG_IS_CMDLINE(UseParNewGC)) {
+ warning("The UseParNewGC flag is deprecated and will likely be removed in a future release");
+ }
if (FLAG_IS_CMDLINE(MaxGCMinorPauseMillis)) {
warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
"and will likely be removed in future release");
@@ -3556,6 +3540,11 @@
}
}
+ if (UseConcMarkSweepGC && FLAG_IS_DEFAULT(UseParNewGC) && !UseParNewGC) {
+ // CMS can only be used with ParNew
+ FLAG_SET_ERGO(bool, UseParNewGC, true);
+ }
+
if (!check_vm_args_consistency()) {
return JNI_ERR;
}
--- a/hotspot/src/share/vm/runtime/arguments.hpp Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.hpp Thu Nov 27 21:02:13 2014 +0100
@@ -472,7 +472,6 @@
// Check for consistency in the selection of the garbage collector.
static bool check_gc_consistency_user(); // Check user-selected gc
static inline bool check_gc_consistency_ergo(); // Check ergonomic-selected gc
- static void check_deprecated_gcs();
static void check_deprecated_gc_flags();
// Check consistency or otherwise of VM argument settings
static bool check_vm_args_consistency();
@@ -615,8 +614,7 @@
};
bool Arguments::gc_selected() {
- return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC ||
- UseParNewGC || UseSerialGC;
+ return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC || UseSerialGC;
}
bool Arguments::check_gc_consistency_ergo() {
--- a/hotspot/test/compiler/8010927/Test8010927.java Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/test/compiler/8010927/Test8010927.java Thu Nov 27 21:02:13 2014 +0100
@@ -29,7 +29,7 @@
* @build Test8010927
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. -Xmx64m -XX:NewSize=20971520 -XX:MaxNewSize=32m -XX:-UseTLAB -XX:-UseParNewGC -XX:-UseAdaptiveSizePolicy Test8010927
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. -Xmx64m -XX:NewSize=20971520 -XX:MaxNewSize=32m -XX:-UseTLAB -XX:-UseAdaptiveSizePolicy Test8010927
*/
import sun.hotspot.WhiteBox;
--- a/hotspot/test/gc/TestSystemGC.java Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/test/gc/TestSystemGC.java Thu Nov 27 21:02:13 2014 +0100
@@ -28,12 +28,10 @@
* @summary Runs System.gc() with different flags.
* @run main/othervm TestSystemGC
* @run main/othervm -XX:+UseSerialGC TestSystemGC
- * @run main/othervm -XX:+UseParNewGC TestSystemGC
* @run main/othervm -XX:+UseParallelGC TestSystemGC
* @run main/othervm -XX:+UseParallelGC -XX:-UseParallelOldGC TestSystemGC
* @run main/othervm -XX:+UseConcMarkSweepGC TestSystemGC
* @run main/othervm -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent TestSystemGC
- * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent -XX:-UseParNewGC TestSystemGC
* @run main/othervm -XX:+UseG1GC TestSystemGC
* @run main/othervm -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent TestSystemGC
* @run main/othervm -XX:+UseLargePages TestSystemGC
--- a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java Thu Nov 27 21:02:13 2014 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2014, 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
@@ -24,8 +24,8 @@
/*
* @test TestDefNewCMS
* @key gc
-* @bug 8006398
-* @summary Test that the deprecated DefNew+CMS combination print a warning message
+* @bug 8065972
+* @summary Test that the unsupported DefNew+CMS combination does not start
* @library /testlibrary
*/
@@ -37,9 +37,9 @@
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release");
- output.shouldNotContain("error");
- output.shouldHaveExitValue(0);
+ output.shouldContain("It is not possible to combine the DefNew young collector with the CMS collector.");
+ output.shouldContain("Error");
+ output.shouldHaveExitValue(1);
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/startup_warnings/TestNoParNew.java Thu Nov 27 21:02:13 2014 +0100
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2014, 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
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+/*
+* @test TestNoParNew
+* @key gc
+* @bug 8065972
+* @summary Test that specifying -XX:-UseParNewGC on the command line logs a warning message
+* @library /testlibrary
+*/
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.ProcessTools;
+
+
+public class TestNoParNew {
+
+ public static void main(String args[]) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseParNewGC", "-version");
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldContain("warning: The UseParNewGC flag is deprecated and will likely be removed in a future release");
+ output.shouldNotContain("error");
+ output.shouldHaveExitValue(0);
+ }
+
+}
--- a/hotspot/test/gc/startup_warnings/TestParNewCMS.java Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/test/gc/startup_warnings/TestParNewCMS.java Thu Nov 27 21:02:13 2014 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2014, 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
@@ -24,8 +24,8 @@
/*
* @test TestParNewCMS
* @key gc
-* @bug 8006398
-* @summary Test that the combination ParNew+CMS does not print a warning message
+* @bug 8065972
+* @summary Test that specifying -XX:+UseParNewGC on the command line logs a warning message
* @library /testlibrary
*/
@@ -38,7 +38,7 @@
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldNotContain("deprecated");
+ output.shouldContain("warning: The UseParNewGC flag is deprecated and will likely be removed in a future release");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
--- a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java Thu Nov 27 11:09:55 2014 +0100
+++ b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java Thu Nov 27 21:02:13 2014 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2024, 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
@@ -24,7 +24,7 @@
/*
* @test TestParNewSerialOld
* @key gc
-* @bug 8006398
+* @bug 8065972
* @summary Test that the deprecated ParNew+SerialOld combination print a warning message
* @library /testlibrary
*/
@@ -38,9 +38,9 @@
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldContain("warning: Using the ParNew young collector with the Serial old collector is deprecated and will likely be removed in a future release");
- output.shouldNotContain("error");
- output.shouldHaveExitValue(0);
+ output.shouldContain("It is not possible to combine the ParNew young collector with the Serial old collector.");
+ output.shouldContain("Error");
+ output.shouldHaveExitValue(1);
}
}