From 35b1fad163d0e2dd534f41ca0d0146271984288b Mon Sep 17 00:00:00 2001 From: jwilhelm Date: Thu, 3 Oct 2013 13:19:19 +0200 Subject: [PATCH] 8025855: Simplify GenRemSet code slightly Summary: Remove a few redundant switch-statements Reviewed-by: jcoomes, tschatzl --- src/share/vm/memory/collectorPolicy.cpp | 11 ++--------- src/share/vm/memory/genRemSet.cpp | 9 ++------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/share/vm/memory/collectorPolicy.cpp b/src/share/vm/memory/collectorPolicy.cpp index 283db680b..99025bcb2 100644 --- a/src/share/vm/memory/collectorPolicy.cpp +++ b/src/share/vm/memory/collectorPolicy.cpp @@ -137,15 +137,8 @@ bool CollectorPolicy::use_should_clear_all_soft_refs(bool v) { GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap, int max_covered_regions) { - switch (rem_set_name()) { - case GenRemSet::CardTable: { - CardTableRS* res = new CardTableRS(whole_heap, max_covered_regions); - return res; - } - default: - guarantee(false, "unrecognized GenRemSet::Name"); - return NULL; - } + assert(rem_set_name() == GenRemSet::CardTable, "unrecognized GenRemSet::Name"); + return new CardTableRS(whole_heap, max_covered_regions); } void CollectorPolicy::cleared_all_soft_refs() { diff --git a/src/share/vm/memory/genRemSet.cpp b/src/share/vm/memory/genRemSet.cpp index 95a08e137..c496deafc 100644 --- a/src/share/vm/memory/genRemSet.cpp +++ b/src/share/vm/memory/genRemSet.cpp @@ -32,13 +32,8 @@ // enumeration.) uintx GenRemSet::max_alignment_constraint(Name nm) { - switch (nm) { - case GenRemSet::CardTable: - return CardTableRS::ct_max_alignment_constraint(); - default: - guarantee(false, "Unrecognized GenRemSet type."); - return (0); // Make Windows compiler happy - } + assert(nm == GenRemSet::CardTable, "Unrecognized GenRemSet type."); + return CardTableRS::ct_max_alignment_constraint(); } class HasAccumulatedModifiedOopsClosure : public KlassClosure { -- GitLab