1
|
1 |
/*
|
|
2 |
* Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 |
* have any questions.
|
|
22 |
*
|
|
23 |
*/
|
|
24 |
|
|
25 |
|
|
26 |
// Contains two generations that both use an AdjoiningVirtualSpaces.
|
|
27 |
// The two generations are adjacent in the reserved space for the
|
|
28 |
// heap. Each generation has a virtual space and shrinking and
|
|
29 |
// expanding of the generations can still be down with that
|
|
30 |
// virtual space as was previously done. If expanding of reserved
|
|
31 |
// size of a generation is required, the adjacent generation
|
|
32 |
// must be shrunk. Adjusting the boundary between the generations
|
|
33 |
// is called for in this class.
|
|
34 |
|
|
35 |
class AdjoiningGenerations : public CHeapObj {
|
|
36 |
friend class VMStructs;
|
|
37 |
private:
|
|
38 |
// The young generation and old generation, respectively
|
|
39 |
PSYoungGen* _young_gen;
|
|
40 |
PSOldGen* _old_gen;
|
|
41 |
|
|
42 |
// The spaces used by the two generations.
|
|
43 |
AdjoiningVirtualSpaces _virtual_spaces;
|
|
44 |
|
|
45 |
// Move boundary up to expand old gen. Checks are made to
|
|
46 |
// determine if the move can be done with specified limits.
|
|
47 |
void request_old_gen_expansion(size_t desired_change_in_bytes);
|
|
48 |
// Move boundary down to expand young gen.
|
|
49 |
bool request_young_gen_expansion(size_t desired_change_in_bytes);
|
|
50 |
|
|
51 |
public:
|
|
52 |
AdjoiningGenerations(ReservedSpace rs,
|
|
53 |
size_t init_low_byte_size,
|
|
54 |
size_t min_low_byte_size,
|
|
55 |
size_t max_low_byte_size,
|
|
56 |
size_t init_high_byte_size,
|
|
57 |
size_t min_high_byte_size,
|
|
58 |
size_t max_high_bytes_size,
|
|
59 |
size_t alignment);
|
|
60 |
|
|
61 |
// Accessors
|
|
62 |
PSYoungGen* young_gen() { return _young_gen; }
|
|
63 |
PSOldGen* old_gen() { return _old_gen; }
|
|
64 |
|
|
65 |
AdjoiningVirtualSpaces* virtual_spaces() { return &_virtual_spaces; }
|
|
66 |
|
|
67 |
// Additional space is needed in the old generation. Check
|
|
68 |
// the available space and attempt to move the boundary if more space
|
|
69 |
// is needed. The growth is not guaranteed to occur.
|
|
70 |
void adjust_boundary_for_old_gen_needs(size_t desired_change_in_bytes);
|
|
71 |
// Similary for a growth of the young generation.
|
|
72 |
void adjust_boundary_for_young_gen_needs(size_t eden_size, size_t survivor_size);
|
|
73 |
|
|
74 |
// Return the total byte size of the reserved space
|
|
75 |
// for the adjoining generations.
|
|
76 |
size_t reserved_byte_size();
|
|
77 |
};
|