8025855: Simplify GenRemSet code slightly
authorjwilhelm
Thu, 03 Oct 2013 13:19:19 +0200
changeset 20316 d3ef45219aac
parent 20315 ea964395b9e9
child 20317 0f5f511b642c
8025855: Simplify GenRemSet code slightly Summary: Remove a few redundant switch-statements Reviewed-by: jcoomes, tschatzl
hotspot/src/share/vm/memory/collectorPolicy.cpp
hotspot/src/share/vm/memory/genRemSet.cpp
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp	Wed Oct 02 18:24:58 2013 +0200
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp	Thu Oct 03 13:19:19 2013 +0200
@@ -137,15 +137,8 @@
 
 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() {
--- a/hotspot/src/share/vm/memory/genRemSet.cpp	Wed Oct 02 18:24:58 2013 +0200
+++ b/hotspot/src/share/vm/memory/genRemSet.cpp	Thu Oct 03 13:19:19 2013 +0200
@@ -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 {