src/share/vm/memory/collectorPolicy.cpp

Print this page




 247   if (NewSize + OldSize > MaxHeapSize) {
 248     if (FLAG_IS_CMDLINE(MaxHeapSize)) {
 249       // somebody set a maximum heap size with the intention that we should not
 250       // exceed it. Adjust New/OldSize as necessary.
 251       uintx calculated_size = NewSize + OldSize;
 252       double shrink_factor = (double) MaxHeapSize / calculated_size;
 253       // align
 254       NewSize = align_size_down((uintx) (NewSize * shrink_factor), min_alignment());
 255       // OldSize is already aligned because above we aligned MaxHeapSize to
 256       // max_alignment(), and we just made sure that NewSize is aligned to
 257       // min_alignment(). In initialize_flags() we verified that max_alignment()
 258       // is a multiple of min_alignment().
 259       OldSize = MaxHeapSize - NewSize;
 260     } else {
 261       MaxHeapSize = NewSize + OldSize;
 262     }
 263   }
 264   // need to do this again
 265   MaxHeapSize = align_size_up(MaxHeapSize, max_alignment());
 266 





















 267   always_do_update_barrier = UseConcMarkSweepGC;
 268 
 269   // Check validity of heap flags
 270   assert(OldSize     % min_alignment() == 0, "old space alignment");
 271   assert(MaxHeapSize % max_alignment() == 0, "maximum heap alignment");
 272 }
 273 
 274 // Values set on the command line win over any ergonomically
 275 // set command line parameters.
 276 // Ergonomic choice of parameters are done before this
 277 // method is called.  Values for command line parameters such as NewSize
 278 // and MaxNewSize feed those ergonomic choices into this method.
 279 // This method makes the final generation sizings consistent with
 280 // themselves and with overall heap sizings.
 281 // In the absence of explicitly set command line flags, policies
 282 // such as the use of NewRatio are used to size the generation.
 283 void GenCollectorPolicy::initialize_size_info() {
 284   CollectorPolicy::initialize_size_info();
 285 
 286   // min_alignment() is used for alignment within a generation.




 247   if (NewSize + OldSize > MaxHeapSize) {
 248     if (FLAG_IS_CMDLINE(MaxHeapSize)) {
 249       // somebody set a maximum heap size with the intention that we should not
 250       // exceed it. Adjust New/OldSize as necessary.
 251       uintx calculated_size = NewSize + OldSize;
 252       double shrink_factor = (double) MaxHeapSize / calculated_size;
 253       // align
 254       NewSize = align_size_down((uintx) (NewSize * shrink_factor), min_alignment());
 255       // OldSize is already aligned because above we aligned MaxHeapSize to
 256       // max_alignment(), and we just made sure that NewSize is aligned to
 257       // min_alignment(). In initialize_flags() we verified that max_alignment()
 258       // is a multiple of min_alignment().
 259       OldSize = MaxHeapSize - NewSize;
 260     } else {
 261       MaxHeapSize = NewSize + OldSize;
 262     }
 263   }
 264   // need to do this again
 265   MaxHeapSize = align_size_up(MaxHeapSize, max_alignment());
 266 
 267   // adjust max heap size if necessary
 268   if (NewSize + OldSize > MaxHeapSize) {
 269     if (FLAG_IS_CMDLINE(MaxHeapSize)) {
 270       // somebody set a maximum heap size with the intention that we should not
 271       // exceed it. Adjust New/OldSize as necessary.
 272       uintx calculated_size = NewSize + OldSize;
 273       double shrink_factor = (double) MaxHeapSize / calculated_size;
 274       // align
 275       NewSize = align_size_down((uintx) (NewSize * shrink_factor), min_alignment());
 276       // OldSize is already aligned because above we aligned MaxHeapSize to
 277       // max_alignment(), and we just made sure that NewSize is aligned to
 278       // min_alignment(). In initialize_flags() we verified that max_alignment()
 279       // is a multiple of min_alignment().
 280       OldSize = MaxHeapSize - NewSize;
 281     } else {
 282       MaxHeapSize = NewSize + OldSize;
 283     }
 284   }
 285   // need to do this again
 286   MaxHeapSize = align_size_up(MaxHeapSize, max_alignment());
 287 
 288   always_do_update_barrier = UseConcMarkSweepGC;
 289 
 290   // Check validity of heap flags
 291   assert(OldSize     % min_alignment() == 0, "old space alignment");
 292   assert(MaxHeapSize % max_alignment() == 0, "maximum heap alignment");
 293 }
 294 
 295 // Values set on the command line win over any ergonomically
 296 // set command line parameters.
 297 // Ergonomic choice of parameters are done before this
 298 // method is called.  Values for command line parameters such as NewSize
 299 // and MaxNewSize feed those ergonomic choices into this method.
 300 // This method makes the final generation sizings consistent with
 301 // themselves and with overall heap sizings.
 302 // In the absence of explicitly set command line flags, policies
 303 // such as the use of NewRatio are used to size the generation.
 304 void GenCollectorPolicy::initialize_size_info() {
 305   CollectorPolicy::initialize_size_info();
 306 
 307   // min_alignment() is used for alignment within a generation.