368 }
369
370 return success;
371 }
372
373
374 void DefNewGeneration::compute_new_size() {
375 // This is called after a gc that includes the following generation
376 // (which is required to exist.) So from-space will normally be empty.
377 // Note that we check both spaces, since if scavenge failed they revert roles.
378 // If not we bail out (otherwise we would have to relocate the objects)
379 if (!from()->is_empty() || !to()->is_empty()) {
380 return;
381 }
382
383 int next_level = level() + 1;
384 GenCollectedHeap* gch = GenCollectedHeap::heap();
385 assert(next_level < gch->_n_gens,
386 "DefNewGeneration cannot be an oldest gen");
387
388 Generation* next_gen = gch->_gens[next_level];
389 size_t old_size = next_gen->capacity();
390 size_t new_size_before = _virtual_space.committed_size();
391 size_t min_new_size = spec()->init_size();
392 size_t max_new_size = reserved().byte_size();
393 assert(min_new_size <= new_size_before &&
394 new_size_before <= max_new_size,
395 "just checking");
396 // All space sizes must be multiples of Generation::GenGrain.
397 size_t alignment = Generation::GenGrain;
398
399 // Compute desired new generation size based on NewRatio and
400 // NewSizeThreadIncrease
401 size_t desired_new_size = old_size/NewRatio;
402 int threads_count = Threads::number_of_non_daemon_threads();
403 size_t thread_increase_size = threads_count * NewSizeThreadIncrease;
404 desired_new_size = align_size_up(desired_new_size + thread_increase_size, alignment);
405
406 // Adjust new generation size
407 desired_new_size = MAX2(MIN2(desired_new_size, max_new_size), min_new_size);
408 assert(desired_new_size <= max_new_size, "just checking");
|
368 }
369
370 return success;
371 }
372
373
374 void DefNewGeneration::compute_new_size() {
375 // This is called after a gc that includes the following generation
376 // (which is required to exist.) So from-space will normally be empty.
377 // Note that we check both spaces, since if scavenge failed they revert roles.
378 // If not we bail out (otherwise we would have to relocate the objects)
379 if (!from()->is_empty() || !to()->is_empty()) {
380 return;
381 }
382
383 int next_level = level() + 1;
384 GenCollectedHeap* gch = GenCollectedHeap::heap();
385 assert(next_level < gch->_n_gens,
386 "DefNewGeneration cannot be an oldest gen");
387
388 Generation* next_gen = gch->get_gen(next_level);
389 size_t old_size = next_gen->capacity();
390 size_t new_size_before = _virtual_space.committed_size();
391 size_t min_new_size = spec()->init_size();
392 size_t max_new_size = reserved().byte_size();
393 assert(min_new_size <= new_size_before &&
394 new_size_before <= max_new_size,
395 "just checking");
396 // All space sizes must be multiples of Generation::GenGrain.
397 size_t alignment = Generation::GenGrain;
398
399 // Compute desired new generation size based on NewRatio and
400 // NewSizeThreadIncrease
401 size_t desired_new_size = old_size/NewRatio;
402 int threads_count = Threads::number_of_non_daemon_threads();
403 size_t thread_increase_size = threads_count * NewSizeThreadIncrease;
404 desired_new_size = align_size_up(desired_new_size + thread_increase_size, alignment);
405
406 // Adjust new generation size
407 desired_new_size = MAX2(MIN2(desired_new_size, max_new_size), min_new_size);
408 assert(desired_new_size <= max_new_size, "just checking");
|