822
823 // Return the number of bytes available for resizing down the young
824 // generation. This is the minimum of
825 // input "bytes"
826 // bytes to the minimum young gen size
827 // bytes to the size currently being used + some small extra
828 size_t PSYoungGen::limit_gen_shrink(size_t bytes) {
829 // Allow shrinkage into the current eden but keep eden large enough
830 // to maintain the minimum young gen size
831 bytes = MIN3(bytes, available_to_min_gen(), available_to_live());
832 return align_down(bytes, virtual_space()->alignment());
833 }
834
835 void PSYoungGen::reset_after_change() {
836 ShouldNotReachHere();
837 }
838
839 void PSYoungGen::reset_survivors_after_shrink() {
840 _reserved = MemRegion((HeapWord*)virtual_space()->low_boundary(),
841 (HeapWord*)virtual_space()->high_boundary());
842 PSScavenge::reference_processor()->set_span(_reserved);
843
844 MutableSpace* space_shrinking = NULL;
845 if (from_space()->end() > to_space()->end()) {
846 space_shrinking = from_space();
847 } else {
848 space_shrinking = to_space();
849 }
850
851 HeapWord* new_end = (HeapWord*)virtual_space()->high();
852 assert(new_end >= space_shrinking->bottom(), "Shrink was too large");
853 // Was there a shrink of the survivor space?
854 if (new_end < space_shrinking->end()) {
855 MemRegion mr(space_shrinking->bottom(), new_end);
856 space_shrinking->initialize(mr,
857 SpaceDecorator::DontClear,
858 SpaceDecorator::Mangle);
859 }
860 }
861
862 // This method currently does not expect to expand into eden (i.e.,
|
822
823 // Return the number of bytes available for resizing down the young
824 // generation. This is the minimum of
825 // input "bytes"
826 // bytes to the minimum young gen size
827 // bytes to the size currently being used + some small extra
828 size_t PSYoungGen::limit_gen_shrink(size_t bytes) {
829 // Allow shrinkage into the current eden but keep eden large enough
830 // to maintain the minimum young gen size
831 bytes = MIN3(bytes, available_to_min_gen(), available_to_live());
832 return align_down(bytes, virtual_space()->alignment());
833 }
834
835 void PSYoungGen::reset_after_change() {
836 ShouldNotReachHere();
837 }
838
839 void PSYoungGen::reset_survivors_after_shrink() {
840 _reserved = MemRegion((HeapWord*)virtual_space()->low_boundary(),
841 (HeapWord*)virtual_space()->high_boundary());
842 PSScavenge::set_subject_to_discovery_span(_reserved);
843
844 MutableSpace* space_shrinking = NULL;
845 if (from_space()->end() > to_space()->end()) {
846 space_shrinking = from_space();
847 } else {
848 space_shrinking = to_space();
849 }
850
851 HeapWord* new_end = (HeapWord*)virtual_space()->high();
852 assert(new_end >= space_shrinking->bottom(), "Shrink was too large");
853 // Was there a shrink of the survivor space?
854 if (new_end < space_shrinking->end()) {
855 MemRegion mr(space_shrinking->bottom(), new_end);
856 space_shrinking->initialize(mr,
857 SpaceDecorator::DontClear,
858 SpaceDecorator::Mangle);
859 }
860 }
861
862 // This method currently does not expect to expand into eden (i.e.,
|