1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.hpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,80 @@ 1.4 +/* 1.5 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGGENERATIONS_HPP 1.29 +#define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGGENERATIONS_HPP 1.30 + 1.31 +#include "gc_implementation/parallelScavenge/adjoiningVirtualSpaces.hpp" 1.32 +#include "gc_implementation/parallelScavenge/asPSOldGen.hpp" 1.33 +#include "gc_implementation/parallelScavenge/asPSYoungGen.hpp" 1.34 +#include "gc_implementation/parallelScavenge/generationSizer.hpp" 1.35 + 1.36 + 1.37 +// Contains two generations that both use an AdjoiningVirtualSpaces. 1.38 +// The two generations are adjacent in the reserved space for the 1.39 +// heap. Each generation has a virtual space and shrinking and 1.40 +// expanding of the generations can still be down with that 1.41 +// virtual space as was previously done. If expanding of reserved 1.42 +// size of a generation is required, the adjacent generation 1.43 +// must be shrunk. Adjusting the boundary between the generations 1.44 +// is called for in this class. 1.45 + 1.46 +class AdjoiningGenerations : public CHeapObj<mtGC> { 1.47 + friend class VMStructs; 1.48 + private: 1.49 + // The young generation and old generation, respectively 1.50 + PSYoungGen* _young_gen; 1.51 + PSOldGen* _old_gen; 1.52 + 1.53 + // The spaces used by the two generations. 1.54 + AdjoiningVirtualSpaces _virtual_spaces; 1.55 + 1.56 + // Move boundary up to expand old gen. Checks are made to 1.57 + // determine if the move can be done with specified limits. 1.58 + void request_old_gen_expansion(size_t desired_change_in_bytes); 1.59 + // Move boundary down to expand young gen. 1.60 + bool request_young_gen_expansion(size_t desired_change_in_bytes); 1.61 + 1.62 + public: 1.63 + AdjoiningGenerations(ReservedSpace rs, GenerationSizer* policy, size_t alignment); 1.64 + 1.65 + // Accessors 1.66 + PSYoungGen* young_gen() { return _young_gen; } 1.67 + PSOldGen* old_gen() { return _old_gen; } 1.68 + 1.69 + AdjoiningVirtualSpaces* virtual_spaces() { return &_virtual_spaces; } 1.70 + 1.71 + // Additional space is needed in the old generation. Check 1.72 + // the available space and attempt to move the boundary if more space 1.73 + // is needed. The growth is not guaranteed to occur. 1.74 + void adjust_boundary_for_old_gen_needs(size_t desired_change_in_bytes); 1.75 + // Similary for a growth of the young generation. 1.76 + void adjust_boundary_for_young_gen_needs(size_t eden_size, size_t survivor_size); 1.77 + 1.78 + // Return the total byte size of the reserved space 1.79 + // for the adjoining generations. 1.80 + size_t reserved_byte_size(); 1.81 +}; 1.82 + 1.83 +#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_ADJOININGGENERATIONS_HPP