Handle Windows and os::vm_allocation_granularity() epsilon-gc-branch
authorshade
Mon, 11 Jun 2018 20:40:30 +0200
branchepsilon-gc-branch
changeset 56737 24339b23a56b
parent 56719 a846e7bbcdfa
child 56740 d6b3c3658d3d
Handle Windows and os::vm_allocation_granularity()
src/hotspot/share/gc/epsilon/epsilonCollectorPolicy.hpp
src/hotspot/share/gc/epsilon/epsilonHeap.cpp
--- a/src/hotspot/share/gc/epsilon/epsilonCollectorPolicy.hpp	Mon Jun 11 09:29:44 2018 +0200
+++ b/src/hotspot/share/gc/epsilon/epsilonCollectorPolicy.hpp	Mon Jun 11 20:40:30 2018 +0200
@@ -30,8 +30,9 @@
 protected:
   virtual void initialize_alignments() {
     size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size();
-    _space_alignment = page_size;
-    _heap_alignment = page_size;
+    size_t align = MAX2((size_t)os::vm_allocation_granularity(), page_size);
+    _space_alignment = align;
+    _heap_alignment  = align;
   }
 
 public:
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp	Mon Jun 11 09:29:44 2018 +0200
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp	Mon Jun 11 20:40:30 2018 +0200
@@ -30,11 +30,12 @@
 #include "memory/resourceArea.hpp"
 
 jint EpsilonHeap::initialize() {
-  size_t init_byte_size = _policy->initial_heap_byte_size();
-  size_t max_byte_size  = _policy->max_heap_byte_size();
+  size_t align = _policy->heap_alignment();
+  size_t init_byte_size = align_up(_policy->initial_heap_byte_size(), align);
+  size_t max_byte_size  = align_up(_policy->max_heap_byte_size(), align);
 
   // Initialize backing storage
-  ReservedSpace heap_rs = Universe::reserve_heap(max_byte_size, _policy->heap_alignment());
+  ReservedSpace heap_rs = Universe::reserve_heap(max_byte_size, align);
   _virtual_space.initialize(heap_rs, init_byte_size);
 
   MemRegion committed_region((HeapWord*)_virtual_space.low(),          (HeapWord*)_virtual_space.high());