changeset 5383:ab68fc0101ce

8025855: Simplify GenRemSet code slightly Summary: Remove a few redundant switch-statements Reviewed-by: jcoomes, tschatzl
author jwilhelm
date Thu, 03 Oct 2013 13:19:19 +0200
parents 379ef2cc19c0
children c49c7f835e8d
files src/share/vm/memory/collectorPolicy.cpp src/share/vm/memory/genRemSet.cpp
diffstat 2 files changed, 4 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/memory/collectorPolicy.cpp	Wed Oct 02 18:24:58 2013 +0200
+++ b/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/src/share/vm/memory/genRemSet.cpp	Wed Oct 02 18:24:58 2013 +0200
+++ b/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 {