< prev index next >

src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp

Print this page
rev 59215 : imported patch max_gen_size


  83 
  84   // Layout the reserved space for the generations.
  85   // If OldGen is allocated on nv-dimm, we need to split the reservation (this is required for windows).
  86   ReservedSpace old_rs   = heap_rs.first_part(MaxOldSize, ParallelArguments::is_heterogeneous_heap() /* split */);
  87   ReservedSpace young_rs = heap_rs.last_part(MaxOldSize);
  88   assert(young_rs.size() == MaxNewSize, "Didn't reserve all of the heap");
  89 
  90   // Create and initialize the generations.
  91   _young_gen = new PSYoungGen(
  92       young_rs,
  93       NewSize,
  94       MinNewSize,
  95       MaxNewSize);
  96   _old_gen = new PSOldGen(
  97       old_rs,
  98       OldSize,
  99       MinOldSize,
 100       MaxOldSize,
 101       "old", 1);
 102 
 103   assert(young_gen()->gen_size_limit() == young_rs.size(),"Consistency check");
 104   assert(old_gen()->gen_size_limit() == old_rs.size(), "Consistency check");
 105 
 106   double max_gc_pause_sec = ((double) MaxGCPauseMillis)/1000.0;
 107   double max_gc_minor_pause_sec = ((double) MaxGCMinorPauseMillis)/1000.0;
 108 
 109   const size_t eden_capacity = _young_gen->eden_space()->capacity_in_bytes();
 110   const size_t old_capacity = _old_gen->capacity_in_bytes();
 111   const size_t initial_promo_size = MIN2(eden_capacity, old_capacity);
 112   _size_policy =
 113     new PSAdaptiveSizePolicy(eden_capacity,
 114                              initial_promo_size,
 115                              young_gen()->to_space()->capacity_in_bytes(),
 116                              GenAlignment,
 117                              max_gc_pause_sec,
 118                              max_gc_minor_pause_sec,
 119                              GCTimeRatio
 120                              );
 121 
 122   assert(ParallelArguments::is_heterogeneous_heap() ||
 123          (old_gen()->virtual_space()->high_boundary() ==
 124           young_gen()->virtual_space()->low_boundary()),


 190 }
 191 
 192 size_t ParallelScavengeHeap::capacity() const {
 193   size_t value = young_gen()->capacity_in_bytes() + old_gen()->capacity_in_bytes();
 194   return value;
 195 }
 196 
 197 size_t ParallelScavengeHeap::used() const {
 198   size_t value = young_gen()->used_in_bytes() + old_gen()->used_in_bytes();
 199   return value;
 200 }
 201 
 202 bool ParallelScavengeHeap::is_maximal_no_gc() const {
 203   return old_gen()->is_maximal_no_gc() && young_gen()->is_maximal_no_gc();
 204 }
 205 
 206 
 207 size_t ParallelScavengeHeap::max_capacity() const {
 208   size_t estimated = reserved_region().byte_size();
 209   if (UseAdaptiveSizePolicy) {
 210     estimated -= _size_policy->max_survivor_size(young_gen()->max_size());
 211   } else {
 212     estimated -= young_gen()->to_space()->capacity_in_bytes();
 213   }
 214   return MAX2(estimated, capacity());
 215 }
 216 
 217 bool ParallelScavengeHeap::is_in(const void* p) const {
 218   return young_gen()->is_in(p) || old_gen()->is_in(p);
 219 }
 220 
 221 bool ParallelScavengeHeap::is_in_reserved(const void* p) const {
 222   return young_gen()->is_in_reserved(p) || old_gen()->is_in_reserved(p);
 223 }
 224 
 225 // There are two levels of allocation policy here.
 226 //
 227 // When an allocation request fails, the requesting thread must invoke a VM
 228 // operation, transfer control to the VM thread, and await the results of a
 229 // garbage collection. That is quite expensive, and we should avoid doing it
 230 // multiple times if possible.




  83 
  84   // Layout the reserved space for the generations.
  85   // If OldGen is allocated on nv-dimm, we need to split the reservation (this is required for windows).
  86   ReservedSpace old_rs   = heap_rs.first_part(MaxOldSize, ParallelArguments::is_heterogeneous_heap() /* split */);
  87   ReservedSpace young_rs = heap_rs.last_part(MaxOldSize);
  88   assert(young_rs.size() == MaxNewSize, "Didn't reserve all of the heap");
  89 
  90   // Create and initialize the generations.
  91   _young_gen = new PSYoungGen(
  92       young_rs,
  93       NewSize,
  94       MinNewSize,
  95       MaxNewSize);
  96   _old_gen = new PSOldGen(
  97       old_rs,
  98       OldSize,
  99       MinOldSize,
 100       MaxOldSize,
 101       "old", 1);
 102 
 103   assert(young_gen()->max_gen_size() == young_rs.size(),"Consistency check");
 104   assert(old_gen()->max_gen_size() == old_rs.size(), "Consistency check");
 105 
 106   double max_gc_pause_sec = ((double) MaxGCPauseMillis)/1000.0;
 107   double max_gc_minor_pause_sec = ((double) MaxGCMinorPauseMillis)/1000.0;
 108 
 109   const size_t eden_capacity = _young_gen->eden_space()->capacity_in_bytes();
 110   const size_t old_capacity = _old_gen->capacity_in_bytes();
 111   const size_t initial_promo_size = MIN2(eden_capacity, old_capacity);
 112   _size_policy =
 113     new PSAdaptiveSizePolicy(eden_capacity,
 114                              initial_promo_size,
 115                              young_gen()->to_space()->capacity_in_bytes(),
 116                              GenAlignment,
 117                              max_gc_pause_sec,
 118                              max_gc_minor_pause_sec,
 119                              GCTimeRatio
 120                              );
 121 
 122   assert(ParallelArguments::is_heterogeneous_heap() ||
 123          (old_gen()->virtual_space()->high_boundary() ==
 124           young_gen()->virtual_space()->low_boundary()),


 190 }
 191 
 192 size_t ParallelScavengeHeap::capacity() const {
 193   size_t value = young_gen()->capacity_in_bytes() + old_gen()->capacity_in_bytes();
 194   return value;
 195 }
 196 
 197 size_t ParallelScavengeHeap::used() const {
 198   size_t value = young_gen()->used_in_bytes() + old_gen()->used_in_bytes();
 199   return value;
 200 }
 201 
 202 bool ParallelScavengeHeap::is_maximal_no_gc() const {
 203   return old_gen()->is_maximal_no_gc() && young_gen()->is_maximal_no_gc();
 204 }
 205 
 206 
 207 size_t ParallelScavengeHeap::max_capacity() const {
 208   size_t estimated = reserved_region().byte_size();
 209   if (UseAdaptiveSizePolicy) {
 210     estimated -= _size_policy->max_survivor_size(young_gen()->max_gen_size());
 211   } else {
 212     estimated -= young_gen()->to_space()->capacity_in_bytes();
 213   }
 214   return MAX2(estimated, capacity());
 215 }
 216 
 217 bool ParallelScavengeHeap::is_in(const void* p) const {
 218   return young_gen()->is_in(p) || old_gen()->is_in(p);
 219 }
 220 
 221 bool ParallelScavengeHeap::is_in_reserved(const void* p) const {
 222   return young_gen()->is_in_reserved(p) || old_gen()->is_in_reserved(p);
 223 }
 224 
 225 // There are two levels of allocation policy here.
 226 //
 227 // When an allocation request fails, the requesting thread must invoke a VM
 228 // operation, transfer control to the VM thread, and await the results of a
 229 // garbage collection. That is quite expensive, and we should avoid doing it
 230 // multiple times if possible.


< prev index next >