src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

Print this page
rev 2637 : Tony's refactoring
rev 2638 : 6929868: G1: introduce min / max young gen size bounds
Summary: Make G1 handle young gen size command line flags more consistently
Reviewed-by: tonyp

*** 1691,1701 **** _hr_printer.commit(curr, curr_end); curr = curr_end; } assert(curr == mr.end(), "post-condition"); } ! g1_policy()->calculate_reserve(n_regions()); } else { // The expansion of the virtual storage space was unsuccessful. // Let's see if it was because we ran out of swap. if (G1ExitOnExpansionFailure && _g1_storage.uncommitted_size() >= aligned_expand_bytes) { --- 1691,1701 ---- _hr_printer.commit(curr, curr_end); curr = curr_end; } assert(curr == mr.end(), "post-condition"); } ! g1_policy()->record_new_heap_size(n_regions()); } else { // The expansion of the virtual storage space was unsuccessful. // Let's see if it was because we ran out of swap. if (G1ExitOnExpansionFailure && _g1_storage.uncommitted_size() >= aligned_expand_bytes) {
*** 1739,1749 **** assert(mr.start() == new_end, "post-condition"); _expansion_regions += num_regions_deleted; update_committed_space(old_end, new_end); HeapRegionRemSet::shrink_heap(n_regions()); ! g1_policy()->calculate_reserve(n_regions()); if (Verbose && PrintGC) { size_t new_mem_size = _g1_storage.committed_size(); gclog_or_tty->print_cr("Shrinking garbage-first heap from %ldK by %ldK to %ldK", old_mem_size/K, aligned_shrink_bytes/K, --- 1739,1749 ---- assert(mr.start() == new_end, "post-condition"); _expansion_regions += num_regions_deleted; update_committed_space(old_end, new_end); HeapRegionRemSet::shrink_heap(n_regions()); ! g1_policy()->record_new_heap_size(n_regions()); if (Verbose && PrintGC) { size_t new_mem_size = _g1_storage.committed_size(); gclog_or_tty->print_cr("Shrinking garbage-first heap from %ldK by %ldK to %ldK", old_mem_size/K, aligned_shrink_bytes/K,
*** 3534,3543 **** --- 3534,3556 ---- g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty); #endif // YOUNG_LIST_VERBOSE init_mutator_alloc_region(); + { + size_t expand_bytes = g1_policy()->expansion_amount(); + if (expand_bytes > 0) { + size_t bytes_before = capacity(); + if (!expand(expand_bytes)) { + // We failed to expand the heap so let's verify that + // committed/uncommitted amount match the backing store + assert(capacity() == _g1_storage.committed_size(), "committed size mismatch"); + assert(max_capacity() == _g1_storage.reserved_size(), "reserved size mismatch"); + } + } + } + double end_time_sec = os::elapsedTime(); double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS; g1_policy()->record_pause_time_ms(pause_time_ms); g1_policy()->record_collection_pause_end();
*** 3575,3597 **** /* option */ VerifyOption_G1UsePrevMarking); } if (was_enabled) ref_processor()->enable_discovery(); - { - size_t expand_bytes = g1_policy()->expansion_amount(); - if (expand_bytes > 0) { - size_t bytes_before = capacity(); - if (!expand(expand_bytes)) { - // We failed to expand the heap so let's verify that - // committed/uncommitted amount match the backing store - assert(capacity() == _g1_storage.committed_size(), "committed size mismatch"); - assert(max_capacity() == _g1_storage.reserved_size(), "reserved size mismatch"); - } - } - } - // We should do this after we potentially expand the heap so // that all the COMMIT events are generated before the end GC // event, and after we retire the GC alloc regions so that all // RETIRE events are generated before the end GC event. _hr_printer.end_gc(false /* full */, (size_t) total_collections()); --- 3588,3597 ----