comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 4785:97c00e21fecb

7125281: G1: heap expansion code is replicated Reviewed-by: brutisso, johnc
author tonyp
date Mon, 09 Jan 2012 23:50:41 -0500
parents 02838862dec8
children 2ace1c4ee8da
comparison
equal deleted inserted replaced
4784:02838862dec8 4785:97c00e21fecb
3791 3791
3792 { 3792 {
3793 size_t expand_bytes = g1_policy()->expansion_amount(); 3793 size_t expand_bytes = g1_policy()->expansion_amount();
3794 if (expand_bytes > 0) { 3794 if (expand_bytes > 0) {
3795 size_t bytes_before = capacity(); 3795 size_t bytes_before = capacity();
3796 // No need for an ergo verbose message here,
3797 // expansion_amount() does this when it returns a value > 0.
3796 if (!expand(expand_bytes)) { 3798 if (!expand(expand_bytes)) {
3797 // We failed to expand the heap so let's verify that 3799 // We failed to expand the heap so let's verify that
3798 // committed/uncommitted amount match the backing store 3800 // committed/uncommitted amount match the backing store
3799 assert(capacity() == _g1_storage.committed_size(), "committed size mismatch"); 3801 assert(capacity() == _g1_storage.committed_size(), "committed size mismatch");
3800 assert(max_capacity() == _g1_storage.reserved_size(), "reserved size mismatch"); 3802 assert(max_capacity() == _g1_storage.reserved_size(), "reserved size mismatch");
3845 3847
3846 assert(!ref_processor_stw()->discovery_enabled(), "Postcondition"); 3848 assert(!ref_processor_stw()->discovery_enabled(), "Postcondition");
3847 ref_processor_stw()->verify_no_references_recorded(); 3849 ref_processor_stw()->verify_no_references_recorded();
3848 3850
3849 // CM reference discovery will be re-enabled if necessary. 3851 // CM reference discovery will be re-enabled if necessary.
3850 }
3851
3852 {
3853 size_t expand_bytes = g1_policy()->expansion_amount();
3854 if (expand_bytes > 0) {
3855 size_t bytes_before = capacity();
3856 // No need for an ergo verbose message here,
3857 // expansion_amount() does this when it returns a value > 0.
3858 if (!expand(expand_bytes)) {
3859 // We failed to expand the heap so let's verify that
3860 // committed/uncommitted amount match the backing store
3861 assert(capacity() == _g1_storage.committed_size(), "committed size mismatch");
3862 assert(max_capacity() == _g1_storage.reserved_size(), "reserved size mismatch");
3863 }
3864 }
3865 } 3852 }
3866 3853
3867 // We should do this after we potentially expand the heap so 3854 // We should do this after we potentially expand the heap so
3868 // that all the COMMIT events are generated before the end GC 3855 // that all the COMMIT events are generated before the end GC
3869 // event, and after we retire the GC alloc regions so that all 3856 // event, and after we retire the GC alloc regions so that all