hotspot/src/share/vm/memory/collectorPolicy.cpp
changeset 19986 33d188c66ed9
parent 19546 f6b7c9e96ea3
child 19991 d0d0186a8cd6
equal deleted inserted replaced
19983:82c1a95ae314 19986:33d188c66ed9
   143     _should_clear_all_soft_refs = size_policy()->gc_overhead_limit_near();
   143     _should_clear_all_soft_refs = size_policy()->gc_overhead_limit_near();
   144   }
   144   }
   145   _all_soft_refs_clear = true;
   145   _all_soft_refs_clear = true;
   146 }
   146 }
   147 
   147 
       
   148 size_t CollectorPolicy::compute_max_alignment() {
       
   149   // The card marking array and the offset arrays for old generations are
       
   150   // committed in os pages as well. Make sure they are entirely full (to
       
   151   // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1
       
   152   // byte entry and the os page size is 4096, the maximum heap size should
       
   153   // be 512*4096 = 2MB aligned.
       
   154 
       
   155   // There is only the GenRemSet in Hotspot and only the GenRemSet::CardTable
       
   156   // is supported.
       
   157   // Requirements of any new remembered set implementations must be added here.
       
   158   size_t alignment = GenRemSet::max_alignment_constraint(GenRemSet::CardTable);
       
   159 
       
   160   // Parallel GC does its own alignment of the generations to avoid requiring a
       
   161   // large page (256M on some platforms) for the permanent generation.  The
       
   162   // other collectors should also be updated to do their own alignment and then
       
   163   // this use of lcm() should be removed.
       
   164   if (UseLargePages && !UseParallelGC) {
       
   165       // in presence of large pages we have to make sure that our
       
   166       // alignment is large page aware
       
   167       alignment = lcm(os::large_page_size(), alignment);
       
   168   }
       
   169 
       
   170   return alignment;
       
   171 }
   148 
   172 
   149 // GenCollectorPolicy methods.
   173 // GenCollectorPolicy methods.
   150 
   174 
   151 size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) {
   175 size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) {
   152   size_t x = base_size / (NewRatio+1);
   176   size_t x = base_size / (NewRatio+1);
   171   _size_policy = new AdaptiveSizePolicy(init_eden_size,
   195   _size_policy = new AdaptiveSizePolicy(init_eden_size,
   172                                         init_promo_size,
   196                                         init_promo_size,
   173                                         init_survivor_size,
   197                                         init_survivor_size,
   174                                         max_gc_pause_sec,
   198                                         max_gc_pause_sec,
   175                                         GCTimeRatio);
   199                                         GCTimeRatio);
   176 }
       
   177 
       
   178 size_t GenCollectorPolicy::compute_max_alignment() {
       
   179   // The card marking array and the offset arrays for old generations are
       
   180   // committed in os pages as well. Make sure they are entirely full (to
       
   181   // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1
       
   182   // byte entry and the os page size is 4096, the maximum heap size should
       
   183   // be 512*4096 = 2MB aligned.
       
   184   size_t alignment = GenRemSet::max_alignment_constraint(rem_set_name());
       
   185 
       
   186   // Parallel GC does its own alignment of the generations to avoid requiring a
       
   187   // large page (256M on some platforms) for the permanent generation.  The
       
   188   // other collectors should also be updated to do their own alignment and then
       
   189   // this use of lcm() should be removed.
       
   190   if (UseLargePages && !UseParallelGC) {
       
   191       // in presence of large pages we have to make sure that our
       
   192       // alignment is large page aware
       
   193       alignment = lcm(os::large_page_size(), alignment);
       
   194   }
       
   195 
       
   196   assert(alignment >= min_alignment(), "Must be");
       
   197 
       
   198   return alignment;
       
   199 }
   200 }
   200 
   201 
   201 void GenCollectorPolicy::initialize_flags() {
   202 void GenCollectorPolicy::initialize_flags() {
   202   // All sizes must be multiples of the generation granularity.
   203   // All sizes must be multiples of the generation granularity.
   203   set_min_alignment((uintx) Generation::GenGrain);
   204   set_min_alignment((uintx) Generation::GenGrain);