Mercurial > hg > truffle
annotate src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp @ 2260:850b2295a494
Merge
author | kvn |
---|---|
date | Mon, 14 Feb 2011 14:36:29 -0800 |
parents | f95d63e2154a |
children | eda9eb483d29 |
rev | line source |
---|---|
0 | 1 /* |
1972 | 2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
337
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
337
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
337
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSYOUNGGEN_HPP |
26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSYOUNGGEN_HPP | |
27 | |
28 #include "gc_implementation/parallelScavenge/objectStartArray.hpp" | |
29 #include "gc_implementation/parallelScavenge/psGenerationCounters.hpp" | |
30 #include "gc_implementation/parallelScavenge/psVirtualspace.hpp" | |
31 #include "gc_implementation/shared/mutableSpace.hpp" | |
32 #include "gc_implementation/shared/spaceCounters.hpp" | |
33 | |
0 | 34 class PSMarkSweepDecorator; |
35 | |
36 class PSYoungGen : public CHeapObj { | |
37 friend class VMStructs; | |
38 friend class ParallelScavengeHeap; | |
39 friend class AdjoiningGenerations; | |
40 | |
41 protected: | |
42 MemRegion _reserved; | |
43 PSVirtualSpace* _virtual_space; | |
44 | |
45 // Spaces | |
46 MutableSpace* _eden_space; | |
47 MutableSpace* _from_space; | |
48 MutableSpace* _to_space; | |
49 | |
50 | |
51 // MarkSweep Decorators | |
52 PSMarkSweepDecorator* _eden_mark_sweep; | |
53 PSMarkSweepDecorator* _from_mark_sweep; | |
54 PSMarkSweepDecorator* _to_mark_sweep; | |
55 | |
56 // Sizing information, in bytes, set in constructor | |
57 const size_t _init_gen_size; | |
58 const size_t _min_gen_size; | |
59 const size_t _max_gen_size; | |
60 | |
61 // Performance counters | |
62 PSGenerationCounters* _gen_counters; | |
63 SpaceCounters* _eden_counters; | |
64 SpaceCounters* _from_counters; | |
65 SpaceCounters* _to_counters; | |
66 | |
67 // Initialize the space boundaries | |
68 void compute_initial_space_boundaries(); | |
69 | |
70 // Space boundary helper | |
71 void set_space_boundaries(size_t eden_size, size_t survivor_size); | |
72 | |
73 virtual bool resize_generation(size_t eden_size, size_t survivor_size); | |
74 virtual void resize_spaces(size_t eden_size, size_t survivor_size); | |
75 | |
76 // Adjust the spaces to be consistent with the virtual space. | |
77 void post_resize(); | |
78 | |
79 // Return number of bytes that the generation can change. | |
80 // These should not be used by PSYoungGen | |
81 virtual size_t available_for_expansion(); | |
82 virtual size_t available_for_contraction(); | |
83 | |
84 // Given a desired shrinkage in the size of the young generation, | |
85 // return the actual size available for shrinkage. | |
86 virtual size_t limit_gen_shrink(size_t desired_change); | |
87 // returns the number of bytes available from the current size | |
88 // down to the minimum generation size. | |
89 size_t available_to_min_gen(); | |
90 // Return the number of bytes available for shrinkage considering | |
91 // the location the live data in the generation. | |
92 virtual size_t available_to_live(); | |
93 | |
94 public: | |
95 // Initialize the generation. | |
96 PSYoungGen(size_t initial_byte_size, | |
97 size_t minimum_byte_size, | |
98 size_t maximum_byte_size); | |
99 void initialize_work(); | |
100 virtual void initialize(ReservedSpace rs, size_t alignment); | |
101 virtual void initialize_virtual_space(ReservedSpace rs, size_t alignment); | |
102 | |
103 MemRegion reserved() const { return _reserved; } | |
104 | |
105 bool is_in(const void* p) const { | |
106 return _virtual_space->contains((void *)p); | |
107 } | |
108 | |
109 bool is_in_reserved(const void* p) const { | |
110 return reserved().contains((void *)p); | |
111 } | |
112 | |
113 MutableSpace* eden_space() const { return _eden_space; } | |
114 MutableSpace* from_space() const { return _from_space; } | |
115 MutableSpace* to_space() const { return _to_space; } | |
116 PSVirtualSpace* virtual_space() const { return _virtual_space; } | |
117 | |
118 // For Adaptive size policy | |
119 size_t min_gen_size() { return _min_gen_size; } | |
120 | |
121 // MarkSweep support | |
122 PSMarkSweepDecorator* eden_mark_sweep() const { return _eden_mark_sweep; } | |
123 PSMarkSweepDecorator* from_mark_sweep() const { return _from_mark_sweep; } | |
124 PSMarkSweepDecorator* to_mark_sweep() const { return _to_mark_sweep; } | |
125 | |
126 void precompact(); | |
127 void adjust_pointers(); | |
128 void compact(); | |
129 | |
130 // Parallel Old | |
131 void move_and_update(ParCompactionManager* cm); | |
132 | |
133 // Called during/after gc | |
134 void swap_spaces(); | |
135 | |
136 // Resize generation using suggested free space size and survivor size | |
137 // NOTE: "eden_size" and "survivor_size" are suggestions only. Current | |
138 // heap layout (particularly, live objects in from space) might | |
139 // not allow us to use these values. | |
140 void resize(size_t eden_size, size_t survivor_size); | |
141 | |
142 // Size info | |
143 size_t capacity_in_bytes() const; | |
144 size_t used_in_bytes() const; | |
145 size_t free_in_bytes() const; | |
146 | |
147 size_t capacity_in_words() const; | |
148 size_t used_in_words() const; | |
149 size_t free_in_words() const; | |
150 | |
151 // The max this generation can grow to | |
152 size_t max_size() const { return _reserved.byte_size(); } | |
153 | |
154 // The max this generation can grow to if the boundary between | |
155 // the generations are allowed to move. | |
156 size_t gen_size_limit() const { return _max_gen_size; } | |
157 | |
158 bool is_maximal_no_gc() const { | |
159 return true; // never expands except at a GC | |
160 } | |
161 | |
162 // Allocation | |
163 HeapWord* allocate(size_t word_size, bool is_tlab) { | |
164 HeapWord* result = eden_space()->cas_allocate(word_size); | |
165 return result; | |
166 } | |
167 | |
168 HeapWord** top_addr() const { return eden_space()->top_addr(); } | |
169 HeapWord** end_addr() const { return eden_space()->end_addr(); } | |
170 | |
171 // Iteration. | |
172 void oop_iterate(OopClosure* cl); | |
173 void object_iterate(ObjectClosure* cl); | |
174 | |
175 virtual void reset_after_change(); | |
176 virtual void reset_survivors_after_shrink(); | |
177 | |
178 // Performance Counter support | |
179 void update_counters(); | |
180 | |
181 // Debugging - do not use for time critical operations | |
182 void print() const; | |
183 void print_on(outputStream* st) const; | |
184 void print_used_change(size_t prev_used) const; | |
185 virtual const char* name() const { return "PSYoungGen"; } | |
186 | |
187 void verify(bool allow_dirty); | |
188 | |
189 // Space boundary invariant checker | |
190 void space_invariants() PRODUCT_RETURN; | |
263
12eea04c8b06
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
0
diff
changeset
|
191 |
12eea04c8b06
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
0
diff
changeset
|
192 // Helper for mangling survivor spaces. |
12eea04c8b06
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
0
diff
changeset
|
193 void mangle_survivors(MutableSpace* s1, |
12eea04c8b06
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
0
diff
changeset
|
194 MemRegion s1MR, |
12eea04c8b06
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
0
diff
changeset
|
195 MutableSpace* s2, |
12eea04c8b06
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
0
diff
changeset
|
196 MemRegion s2MR) PRODUCT_RETURN; |
12eea04c8b06
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
0
diff
changeset
|
197 |
12eea04c8b06
6672698: mangle_unused_area() should not remangle the entire heap at each collection.
jmasa
parents:
0
diff
changeset
|
198 void record_spaces_top() PRODUCT_RETURN; |
0 | 199 }; |
1972 | 200 |
201 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSYOUNGGEN_HPP |