diff src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp @ 13060:8f07aa079343

8016309: assert(eden_size > 0 && survivor_size > 0) failed: just checking 7057939: jmap shows MaxNewSize=4GB when Java is using parallel collector Summary: Major cleanup of the collectorpolicy classes Reviewed-by: tschatzl, jcoomes
author jwilhelm
date Fri, 01 Nov 2013 17:09:38 +0100
parents 46d7652b223c
children ff355e26c78d cfd4aac53239
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp	Mon Oct 21 18:56:20 2013 +0200
+++ b/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.hpp	Fri Nov 01 17:09:38 2013 +0100
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_HPP
 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_HPP
 
+#include "gc_implementation/parallelScavenge/generationSizer.hpp"
 #include "gc_implementation/parallelScavenge/objectStartArray.hpp"
 #include "gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp"
 #include "gc_implementation/parallelScavenge/psOldGen.hpp"
@@ -32,13 +33,12 @@
 #include "gc_implementation/shared/gcPolicyCounters.hpp"
 #include "gc_implementation/shared/gcWhen.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
+#include "memory/collectorPolicy.hpp"
 #include "utilities/ostream.hpp"
 
 class AdjoiningGenerations;
 class GCHeapSummary;
 class GCTaskManager;
-class GenerationSizer;
-class CollectorPolicy;
 class PSAdaptiveSizePolicy;
 class PSHeapSummary;
 
@@ -54,13 +54,8 @@
 
   static ParallelScavengeHeap* _psh;
 
-  size_t _young_gen_alignment;
-  size_t _old_gen_alignment;
-
   GenerationSizer* _collector_policy;
 
-  inline size_t set_alignment(size_t& var, size_t val);
-
   // Collection of generations that are adjacent in the
   // space reserved for the heap.
   AdjoiningGenerations* _gens;
@@ -80,15 +75,7 @@
   HeapWord* mem_allocate_old_gen(size_t size);
 
  public:
-  ParallelScavengeHeap() : CollectedHeap(), _death_march_count(0) {
-    set_alignment(_young_gen_alignment, intra_heap_alignment());
-    set_alignment(_old_gen_alignment, intra_heap_alignment());
-  }
-
-  // Return the (conservative) maximum heap alignment
-  static size_t conservative_max_heap_alignment() {
-    return GenCollectorPolicy::intra_heap_alignment();
-  }
+  ParallelScavengeHeap() : CollectedHeap(), _death_march_count(0) { }
 
   // For use by VM operations
   enum CollectionType {
@@ -120,13 +107,15 @@
 
   void post_initialize();
   void update_counters();
-  // The alignment used for the various generations.
-  size_t young_gen_alignment() const { return _young_gen_alignment; }
-  size_t old_gen_alignment()  const { return _old_gen_alignment; }
+
+  // The alignment used for the various areas
+  size_t space_alignment()      { return _collector_policy->space_alignment(); }
+  size_t generation_alignment() { return _collector_policy->gen_alignment(); }
 
-  // The alignment used for eden and survivors within the young gen
-  // and for boundary between young gen and old gen.
-  size_t intra_heap_alignment() { return GenCollectorPolicy::intra_heap_alignment(); }
+  // Return the (conservative) maximum heap alignment
+  static size_t conservative_max_heap_alignment() {
+    return CollectorPolicy::compute_heap_alignment();
+  }
 
   size_t capacity() const;
   size_t used() const;
@@ -261,11 +250,4 @@
   };
 };
 
-inline size_t ParallelScavengeHeap::set_alignment(size_t& var, size_t val)
-{
-  assert(is_power_of_2((intptr_t)val), "must be a power of 2");
-  var = round_to(val, intra_heap_alignment());
-  return var;
-}
-
 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_HPP