File: | jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp |
Warning: | line 378, column 3 Value stored to 'delta_start' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | /* |
2 | * Copyright (c) 2001, 2021, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 | * or visit www.oracle.com if you need additional information or have any |
21 | * questions. |
22 | * |
23 | */ |
24 | |
25 | #include "precompiled.hpp" |
26 | #include "gc/parallel/mutableNUMASpace.hpp" |
27 | #include "gc/parallel/parallelScavengeHeap.hpp" |
28 | #include "gc/parallel/psScavenge.hpp" |
29 | #include "gc/parallel/psYoungGen.hpp" |
30 | #include "gc/shared/gcUtil.hpp" |
31 | #include "gc/shared/genArguments.hpp" |
32 | #include "gc/shared/spaceDecorator.inline.hpp" |
33 | #include "logging/log.hpp" |
34 | #include "oops/oop.inline.hpp" |
35 | #include "runtime/java.hpp" |
36 | #include "utilities/align.hpp" |
37 | |
38 | PSYoungGen::PSYoungGen(ReservedSpace rs, size_t initial_size, size_t min_size, size_t max_size) : |
39 | _reserved(), |
40 | _virtual_space(NULL__null), |
41 | _eden_space(NULL__null), |
42 | _from_space(NULL__null), |
43 | _to_space(NULL__null), |
44 | _min_gen_size(min_size), |
45 | _max_gen_size(max_size), |
46 | _gen_counters(NULL__null), |
47 | _eden_counters(NULL__null), |
48 | _from_counters(NULL__null), |
49 | _to_counters(NULL__null) |
50 | { |
51 | initialize(rs, initial_size, GenAlignment); |
52 | } |
53 | |
54 | void PSYoungGen::initialize_virtual_space(ReservedSpace rs, |
55 | size_t initial_size, |
56 | size_t alignment) { |
57 | assert(initial_size != 0, "Should have a finite size")do { if (!(initial_size != 0)) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 57, "assert(" "initial_size != 0" ") failed", "Should have a finite size" ); ::breakpoint(); } } while (0); |
58 | _virtual_space = new PSVirtualSpace(rs, alignment); |
59 | if (!virtual_space()->expand_by(initial_size)) { |
60 | vm_exit_during_initialization("Could not reserve enough space for object heap"); |
61 | } |
62 | } |
63 | |
64 | void PSYoungGen::initialize(ReservedSpace rs, size_t initial_size, size_t alignment) { |
65 | initialize_virtual_space(rs, initial_size, alignment); |
66 | initialize_work(); |
67 | } |
68 | |
69 | void PSYoungGen::initialize_work() { |
70 | |
71 | _reserved = MemRegion((HeapWord*)virtual_space()->low_boundary(), |
72 | (HeapWord*)virtual_space()->high_boundary()); |
73 | assert(_reserved.byte_size() == max_gen_size(), "invariant")do { if (!(_reserved.byte_size() == max_gen_size())) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 73, "assert(" "_reserved.byte_size() == max_gen_size()" ") failed" , "invariant"); ::breakpoint(); } } while (0); |
74 | |
75 | MemRegion cmr((HeapWord*)virtual_space()->low(), |
76 | (HeapWord*)virtual_space()->high()); |
77 | ParallelScavengeHeap::heap()->card_table()->resize_covered_region(cmr); |
78 | |
79 | if (ZapUnusedHeapArea) { |
80 | // Mangle newly committed space immediately because it |
81 | // can be done here more simply that after the new |
82 | // spaces have been computed. |
83 | SpaceMangler::mangle_region(cmr); |
84 | } |
85 | |
86 | if (UseNUMA) { |
87 | _eden_space = new MutableNUMASpace(virtual_space()->alignment()); |
88 | } else { |
89 | _eden_space = new MutableSpace(virtual_space()->alignment()); |
90 | } |
91 | _from_space = new MutableSpace(virtual_space()->alignment()); |
92 | _to_space = new MutableSpace(virtual_space()->alignment()); |
93 | |
94 | // Generation Counters - generation 0, 3 subspaces |
95 | _gen_counters = new PSGenerationCounters("new", 0, 3, min_gen_size(), |
96 | max_gen_size(), virtual_space()); |
97 | |
98 | // Compute maximum space sizes for performance counters |
99 | size_t alignment = SpaceAlignment; |
100 | size_t size = virtual_space()->reserved_size(); |
101 | |
102 | size_t max_survivor_size; |
103 | size_t max_eden_size; |
104 | |
105 | if (UseAdaptiveSizePolicy) { |
106 | max_survivor_size = size / MinSurvivorRatio; |
107 | |
108 | // round the survivor space size down to the nearest alignment |
109 | // and make sure its size is greater than 0. |
110 | max_survivor_size = align_down(max_survivor_size, alignment); |
111 | max_survivor_size = MAX2(max_survivor_size, alignment); |
112 | |
113 | // set the maximum size of eden to be the size of the young gen |
114 | // less two times the minimum survivor size. The minimum survivor |
115 | // size for UseAdaptiveSizePolicy is one alignment. |
116 | max_eden_size = size - 2 * alignment; |
117 | } else { |
118 | max_survivor_size = size / InitialSurvivorRatio; |
119 | |
120 | // round the survivor space size down to the nearest alignment |
121 | // and make sure its size is greater than 0. |
122 | max_survivor_size = align_down(max_survivor_size, alignment); |
123 | max_survivor_size = MAX2(max_survivor_size, alignment); |
124 | |
125 | // set the maximum size of eden to be the size of the young gen |
126 | // less two times the survivor size when the generation is 100% |
127 | // committed. The minimum survivor size for -UseAdaptiveSizePolicy |
128 | // is dependent on the committed portion (current capacity) of the |
129 | // generation - the less space committed, the smaller the survivor |
130 | // space, possibly as small as an alignment. However, we are interested |
131 | // in the case where the young generation is 100% committed, as this |
132 | // is the point where eden reaches its maximum size. At this point, |
133 | // the size of a survivor space is max_survivor_size. |
134 | max_eden_size = size - 2 * max_survivor_size; |
135 | } |
136 | |
137 | _eden_counters = new SpaceCounters("eden", 0, max_eden_size, _eden_space, |
138 | _gen_counters); |
139 | _from_counters = new SpaceCounters("s0", 1, max_survivor_size, _from_space, |
140 | _gen_counters); |
141 | _to_counters = new SpaceCounters("s1", 2, max_survivor_size, _to_space, |
142 | _gen_counters); |
143 | |
144 | compute_initial_space_boundaries(); |
145 | } |
146 | |
147 | void PSYoungGen::compute_initial_space_boundaries() { |
148 | // Compute sizes |
149 | size_t size = virtual_space()->committed_size(); |
150 | assert(size >= 3 * SpaceAlignment, "Young space is not large enough for eden + 2 survivors")do { if (!(size >= 3 * SpaceAlignment)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 150, "assert(" "size >= 3 * SpaceAlignment" ") failed", "Young space is not large enough for eden + 2 survivors" ); ::breakpoint(); } } while (0); |
151 | |
152 | size_t survivor_size = size / InitialSurvivorRatio; |
153 | survivor_size = align_down(survivor_size, SpaceAlignment); |
154 | // ... but never less than an alignment |
155 | survivor_size = MAX2(survivor_size, SpaceAlignment); |
156 | |
157 | // Young generation is eden + 2 survivor spaces |
158 | size_t eden_size = size - (2 * survivor_size); |
159 | |
160 | // Now go ahead and set 'em. |
161 | set_space_boundaries(eden_size, survivor_size); |
162 | space_invariants(); |
163 | |
164 | if (UsePerfData) { |
165 | _eden_counters->update_capacity(); |
166 | _from_counters->update_capacity(); |
167 | _to_counters->update_capacity(); |
168 | } |
169 | } |
170 | |
171 | void PSYoungGen::set_space_boundaries(size_t eden_size, size_t survivor_size) { |
172 | assert(eden_size < virtual_space()->committed_size(), "just checking")do { if (!(eden_size < virtual_space()->committed_size( ))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 172, "assert(" "eden_size < virtual_space()->committed_size()" ") failed", "just checking"); ::breakpoint(); } } while (0); |
173 | assert(eden_size > 0 && survivor_size > 0, "just checking")do { if (!(eden_size > 0 && survivor_size > 0)) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 173, "assert(" "eden_size > 0 && survivor_size > 0" ") failed", "just checking"); ::breakpoint(); } } while (0); |
174 | |
175 | // Initial layout is Eden, to, from. After swapping survivor spaces, |
176 | // that leaves us with Eden, from, to, which is step one in our two |
177 | // step resize-with-live-data procedure. |
178 | char *eden_start = virtual_space()->low(); |
179 | char *to_start = eden_start + eden_size; |
180 | char *from_start = to_start + survivor_size; |
181 | char *from_end = from_start + survivor_size; |
182 | |
183 | assert(from_end == virtual_space()->high(), "just checking")do { if (!(from_end == virtual_space()->high())) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 183, "assert(" "from_end == virtual_space()->high()" ") failed" , "just checking"); ::breakpoint(); } } while (0); |
184 | assert(is_object_aligned(eden_start), "checking alignment")do { if (!(is_object_aligned(eden_start))) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 184, "assert(" "is_object_aligned(eden_start)" ") failed", "checking alignment" ); ::breakpoint(); } } while (0); |
185 | assert(is_object_aligned(to_start), "checking alignment")do { if (!(is_object_aligned(to_start))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 185, "assert(" "is_object_aligned(to_start)" ") failed", "checking alignment" ); ::breakpoint(); } } while (0); |
186 | assert(is_object_aligned(from_start), "checking alignment")do { if (!(is_object_aligned(from_start))) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 186, "assert(" "is_object_aligned(from_start)" ") failed", "checking alignment" ); ::breakpoint(); } } while (0); |
187 | |
188 | MemRegion eden_mr((HeapWord*)eden_start, (HeapWord*)to_start); |
189 | MemRegion to_mr ((HeapWord*)to_start, (HeapWord*)from_start); |
190 | MemRegion from_mr((HeapWord*)from_start, (HeapWord*)from_end); |
191 | |
192 | WorkerThreads& pretouch_workers = ParallelScavengeHeap::heap()->workers(); |
193 | eden_space()->initialize(eden_mr, true, ZapUnusedHeapArea, MutableSpace::SetupPages, &pretouch_workers); |
194 | to_space()->initialize(to_mr , true, ZapUnusedHeapArea, MutableSpace::SetupPages, &pretouch_workers); |
195 | from_space()->initialize(from_mr, true, ZapUnusedHeapArea, MutableSpace::SetupPages, &pretouch_workers); |
196 | } |
197 | |
198 | #ifndef PRODUCT |
199 | void PSYoungGen::space_invariants() { |
200 | // Currently, our eden size cannot shrink to zero |
201 | guarantee(eden_space()->capacity_in_bytes() >= SpaceAlignment, "eden too small")do { if (!(eden_space()->capacity_in_bytes() >= SpaceAlignment )) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 201, "guarantee(" "eden_space()->capacity_in_bytes() >= SpaceAlignment" ") failed", "eden too small"); ::breakpoint(); } } while (0); |
202 | guarantee(from_space()->capacity_in_bytes() >= SpaceAlignment, "from too small")do { if (!(from_space()->capacity_in_bytes() >= SpaceAlignment )) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 202, "guarantee(" "from_space()->capacity_in_bytes() >= SpaceAlignment" ") failed", "from too small"); ::breakpoint(); } } while (0); |
203 | guarantee(to_space()->capacity_in_bytes() >= SpaceAlignment, "to too small")do { if (!(to_space()->capacity_in_bytes() >= SpaceAlignment )) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 203, "guarantee(" "to_space()->capacity_in_bytes() >= SpaceAlignment" ") failed", "to too small"); ::breakpoint(); } } while (0); |
204 | |
205 | // Relationship of spaces to each other |
206 | char* eden_start = (char*)eden_space()->bottom(); |
207 | char* eden_end = (char*)eden_space()->end(); |
208 | char* from_start = (char*)from_space()->bottom(); |
209 | char* from_end = (char*)from_space()->end(); |
210 | char* to_start = (char*)to_space()->bottom(); |
211 | char* to_end = (char*)to_space()->end(); |
212 | |
213 | guarantee(eden_start >= virtual_space()->low(), "eden bottom")do { if (!(eden_start >= virtual_space()->low())) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 213, "guarantee(" "eden_start >= virtual_space()->low()" ") failed", "eden bottom"); ::breakpoint(); } } while (0); |
214 | guarantee(eden_start < eden_end, "eden space consistency")do { if (!(eden_start < eden_end)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 214, "guarantee(" "eden_start < eden_end" ") failed", "eden space consistency" ); ::breakpoint(); } } while (0); |
215 | guarantee(from_start < from_end, "from space consistency")do { if (!(from_start < from_end)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 215, "guarantee(" "from_start < from_end" ") failed", "from space consistency" ); ::breakpoint(); } } while (0); |
216 | guarantee(to_start < to_end, "to space consistency")do { if (!(to_start < to_end)) { (*g_assert_poison) = 'X'; ; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 216, "guarantee(" "to_start < to_end" ") failed", "to space consistency" ); ::breakpoint(); } } while (0); |
217 | |
218 | // Check whether from space is below to space |
219 | if (from_start < to_start) { |
220 | // Eden, from, to |
221 | guarantee(eden_end <= from_start, "eden/from boundary")do { if (!(eden_end <= from_start)) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 221, "guarantee(" "eden_end <= from_start" ") failed", "eden/from boundary" ); ::breakpoint(); } } while (0); |
222 | guarantee(from_end <= to_start, "from/to boundary")do { if (!(from_end <= to_start)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 222, "guarantee(" "from_end <= to_start" ") failed", "from/to boundary" ); ::breakpoint(); } } while (0); |
223 | guarantee(to_end <= virtual_space()->high(), "to end")do { if (!(to_end <= virtual_space()->high())) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 223, "guarantee(" "to_end <= virtual_space()->high()" ") failed", "to end"); ::breakpoint(); } } while (0); |
224 | } else { |
225 | // Eden, to, from |
226 | guarantee(eden_end <= to_start, "eden/to boundary")do { if (!(eden_end <= to_start)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 226, "guarantee(" "eden_end <= to_start" ") failed", "eden/to boundary" ); ::breakpoint(); } } while (0); |
227 | guarantee(to_end <= from_start, "to/from boundary")do { if (!(to_end <= from_start)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 227, "guarantee(" "to_end <= from_start" ") failed", "to/from boundary" ); ::breakpoint(); } } while (0); |
228 | guarantee(from_end <= virtual_space()->high(), "from end")do { if (!(from_end <= virtual_space()->high())) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 228, "guarantee(" "from_end <= virtual_space()->high()" ") failed", "from end"); ::breakpoint(); } } while (0); |
229 | } |
230 | |
231 | // More checks that the virtual space is consistent with the spaces |
232 | assert(virtual_space()->committed_size() >=do { if (!(virtual_space()->committed_size() >= (eden_space ()->capacity_in_bytes() + to_space()->capacity_in_bytes () + from_space()->capacity_in_bytes()))) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 235, "assert(" "virtual_space()->committed_size() >= (eden_space()->capacity_in_bytes() + to_space()->capacity_in_bytes() + from_space()->capacity_in_bytes())" ") failed", "Committed size is inconsistent"); ::breakpoint( ); } } while (0) |
233 | (eden_space()->capacity_in_bytes() +do { if (!(virtual_space()->committed_size() >= (eden_space ()->capacity_in_bytes() + to_space()->capacity_in_bytes () + from_space()->capacity_in_bytes()))) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 235, "assert(" "virtual_space()->committed_size() >= (eden_space()->capacity_in_bytes() + to_space()->capacity_in_bytes() + from_space()->capacity_in_bytes())" ") failed", "Committed size is inconsistent"); ::breakpoint( ); } } while (0) |
234 | to_space()->capacity_in_bytes() +do { if (!(virtual_space()->committed_size() >= (eden_space ()->capacity_in_bytes() + to_space()->capacity_in_bytes () + from_space()->capacity_in_bytes()))) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 235, "assert(" "virtual_space()->committed_size() >= (eden_space()->capacity_in_bytes() + to_space()->capacity_in_bytes() + from_space()->capacity_in_bytes())" ") failed", "Committed size is inconsistent"); ::breakpoint( ); } } while (0) |
235 | from_space()->capacity_in_bytes()), "Committed size is inconsistent")do { if (!(virtual_space()->committed_size() >= (eden_space ()->capacity_in_bytes() + to_space()->capacity_in_bytes () + from_space()->capacity_in_bytes()))) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 235, "assert(" "virtual_space()->committed_size() >= (eden_space()->capacity_in_bytes() + to_space()->capacity_in_bytes() + from_space()->capacity_in_bytes())" ") failed", "Committed size is inconsistent"); ::breakpoint( ); } } while (0); |
236 | assert(virtual_space()->committed_size() <= virtual_space()->reserved_size(),do { if (!(virtual_space()->committed_size() <= virtual_space ()->reserved_size())) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 237, "assert(" "virtual_space()->committed_size() <= virtual_space()->reserved_size()" ") failed", "Space invariant"); ::breakpoint(); } } while (0 ) |
237 | "Space invariant")do { if (!(virtual_space()->committed_size() <= virtual_space ()->reserved_size())) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 237, "assert(" "virtual_space()->committed_size() <= virtual_space()->reserved_size()" ") failed", "Space invariant"); ::breakpoint(); } } while (0 ); |
238 | char* eden_top = (char*)eden_space()->top(); |
239 | char* from_top = (char*)from_space()->top(); |
240 | char* to_top = (char*)to_space()->top(); |
241 | assert(eden_top <= virtual_space()->high(), "eden top")do { if (!(eden_top <= virtual_space()->high())) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 241, "assert(" "eden_top <= virtual_space()->high()" ") failed" , "eden top"); ::breakpoint(); } } while (0); |
242 | assert(from_top <= virtual_space()->high(), "from top")do { if (!(from_top <= virtual_space()->high())) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 242, "assert(" "from_top <= virtual_space()->high()" ") failed" , "from top"); ::breakpoint(); } } while (0); |
243 | assert(to_top <= virtual_space()->high(), "to top")do { if (!(to_top <= virtual_space()->high())) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 243, "assert(" "to_top <= virtual_space()->high()" ") failed" , "to top"); ::breakpoint(); } } while (0); |
244 | |
245 | virtual_space()->verify(); |
246 | } |
247 | #endif |
248 | |
249 | void PSYoungGen::resize(size_t eden_size, size_t survivor_size) { |
250 | // Resize the generation if needed. If the generation resize |
251 | // reports false, do not attempt to resize the spaces. |
252 | if (resize_generation(eden_size, survivor_size)) { |
253 | // Then we lay out the spaces inside the generation |
254 | resize_spaces(eden_size, survivor_size); |
255 | |
256 | space_invariants(); |
257 | |
258 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>("Young generation size: " |
259 | "desired eden: " SIZE_FORMAT"%" "l" "u" " survivor: " SIZE_FORMAT"%" "l" "u" |
260 | " used: " SIZE_FORMAT"%" "l" "u" " capacity: " SIZE_FORMAT"%" "l" "u" |
261 | " gen limits: " SIZE_FORMAT"%" "l" "u" " / " SIZE_FORMAT"%" "l" "u", |
262 | eden_size, survivor_size, used_in_bytes(), capacity_in_bytes(), |
263 | max_gen_size(), min_gen_size()); |
264 | } |
265 | } |
266 | |
267 | |
268 | bool PSYoungGen::resize_generation(size_t eden_size, size_t survivor_size) { |
269 | const size_t alignment = virtual_space()->alignment(); |
270 | size_t orig_size = virtual_space()->committed_size(); |
271 | bool size_changed = false; |
272 | |
273 | // There used to be this guarantee there. |
274 | // guarantee ((eden_size + 2*survivor_size) <= max_gen_size(), "incorrect input arguments"); |
275 | // Code below forces this requirement. In addition the desired eden |
276 | // size and desired survivor sizes are desired goals and may |
277 | // exceed the total generation size. |
278 | |
279 | assert(min_gen_size() <= orig_size && orig_size <= max_gen_size(), "just checking")do { if (!(min_gen_size() <= orig_size && orig_size <= max_gen_size())) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 279, "assert(" "min_gen_size() <= orig_size && orig_size <= max_gen_size()" ") failed", "just checking"); ::breakpoint(); } } while (0); |
280 | |
281 | // Adjust new generation size |
282 | const size_t eden_plus_survivors = |
283 | align_up(eden_size + 2 * survivor_size, alignment); |
284 | size_t desired_size = clamp(eden_plus_survivors, min_gen_size(), max_gen_size()); |
285 | assert(desired_size <= max_gen_size(), "just checking")do { if (!(desired_size <= max_gen_size())) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 285, "assert(" "desired_size <= max_gen_size()" ") failed" , "just checking"); ::breakpoint(); } } while (0); |
286 | |
287 | if (desired_size > orig_size) { |
288 | // Grow the generation |
289 | size_t change = desired_size - orig_size; |
290 | assert(change % alignment == 0, "just checking")do { if (!(change % alignment == 0)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 290, "assert(" "change % alignment == 0" ") failed", "just checking" ); ::breakpoint(); } } while (0); |
291 | HeapWord* prev_high = (HeapWord*) virtual_space()->high(); |
292 | if (!virtual_space()->expand_by(change)) { |
293 | return false; // Error if we fail to resize! |
294 | } |
295 | if (ZapUnusedHeapArea) { |
296 | // Mangle newly committed space immediately because it |
297 | // can be done here more simply that after the new |
298 | // spaces have been computed. |
299 | HeapWord* new_high = (HeapWord*) virtual_space()->high(); |
300 | MemRegion mangle_region(prev_high, new_high); |
301 | SpaceMangler::mangle_region(mangle_region); |
302 | } |
303 | size_changed = true; |
304 | } else if (desired_size < orig_size) { |
305 | size_t desired_change = orig_size - desired_size; |
306 | assert(desired_change % alignment == 0, "just checking")do { if (!(desired_change % alignment == 0)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 306, "assert(" "desired_change % alignment == 0" ") failed" , "just checking"); ::breakpoint(); } } while (0); |
307 | |
308 | desired_change = limit_gen_shrink(desired_change); |
309 | |
310 | if (desired_change > 0) { |
311 | virtual_space()->shrink_by(desired_change); |
312 | reset_survivors_after_shrink(); |
313 | |
314 | size_changed = true; |
315 | } |
316 | } else { |
317 | if (orig_size == max_gen_size()) { |
318 | log_trace(gc)(!(LogImpl<(LogTag::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>("PSYoung generation size at maximum: " SIZE_FORMAT"%" "l" "u" "K", orig_size/K); |
319 | } else if (orig_size == min_gen_size()) { |
320 | log_trace(gc)(!(LogImpl<(LogTag::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>("PSYoung generation size at minimum: " SIZE_FORMAT"%" "l" "u" "K", orig_size/K); |
321 | } |
322 | } |
323 | |
324 | if (size_changed) { |
325 | post_resize(); |
326 | log_trace(gc)(!(LogImpl<(LogTag::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>("PSYoung generation size changed: " SIZE_FORMAT"%" "l" "u" "K->" SIZE_FORMAT"%" "l" "u" "K", |
327 | orig_size/K, virtual_space()->committed_size()/K); |
328 | } |
329 | |
330 | guarantee(eden_plus_survivors <= virtual_space()->committed_size() ||do { if (!(eden_plus_survivors <= virtual_space()->committed_size () || virtual_space()->committed_size() == max_gen_size()) ) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 331, "guarantee(" "eden_plus_survivors <= virtual_space()->committed_size() || virtual_space()->committed_size() == max_gen_size()" ") failed", "Sanity"); ::breakpoint(); } } while (0) |
331 | virtual_space()->committed_size() == max_gen_size(), "Sanity")do { if (!(eden_plus_survivors <= virtual_space()->committed_size () || virtual_space()->committed_size() == max_gen_size()) ) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 331, "guarantee(" "eden_plus_survivors <= virtual_space()->committed_size() || virtual_space()->committed_size() == max_gen_size()" ") failed", "Sanity"); ::breakpoint(); } } while (0); |
332 | |
333 | return true; |
334 | } |
335 | |
336 | #ifndef PRODUCT |
337 | // In the numa case eden is not mangled so a survivor space |
338 | // moving into a region previously occupied by a survivor |
339 | // may find an unmangled region. Also in the PS case eden |
340 | // to-space and from-space may not touch (i.e., there may be |
341 | // gaps between them due to movement while resizing the |
342 | // spaces). Those gaps must be mangled. |
343 | void PSYoungGen::mangle_survivors(MutableSpace* s1, |
344 | MemRegion s1MR, |
345 | MutableSpace* s2, |
346 | MemRegion s2MR) { |
347 | // Check eden and gap between eden and from-space, in deciding |
348 | // what to mangle in from-space. Check the gap between from-space |
349 | // and to-space when deciding what to mangle. |
350 | // |
351 | // +--------+ +----+ +---+ |
352 | // | eden | |s1 | |s2 | |
353 | // +--------+ +----+ +---+ |
354 | // +-------+ +-----+ |
355 | // |s1MR | |s2MR | |
356 | // +-------+ +-----+ |
357 | // All of survivor-space is properly mangled so find the |
358 | // upper bound on the mangling for any portion above current s1. |
359 | HeapWord* delta_end = MIN2(s1->bottom(), s1MR.end()); |
360 | MemRegion delta1_left; |
361 | if (s1MR.start() < delta_end) { |
362 | delta1_left = MemRegion(s1MR.start(), delta_end); |
363 | s1->mangle_region(delta1_left); |
364 | } |
365 | // Find any portion to the right of the current s1. |
366 | HeapWord* delta_start = MAX2(s1->end(), s1MR.start()); |
367 | MemRegion delta1_right; |
368 | if (delta_start < s1MR.end()) { |
369 | delta1_right = MemRegion(delta_start, s1MR.end()); |
370 | s1->mangle_region(delta1_right); |
371 | } |
372 | |
373 | // Similarly for the second survivor space except that |
374 | // any of the new region that overlaps with the current |
375 | // region of the first survivor space has already been |
376 | // mangled. |
377 | delta_end = MIN2(s2->bottom(), s2MR.end()); |
378 | delta_start = MAX2(s2MR.start(), s1->end()); |
Value stored to 'delta_start' is never read | |
379 | MemRegion delta2_left; |
380 | if (s2MR.start() < delta_end) { |
381 | delta2_left = MemRegion(s2MR.start(), delta_end); |
382 | s2->mangle_region(delta2_left); |
383 | } |
384 | delta_start = MAX2(s2->end(), s2MR.start()); |
385 | MemRegion delta2_right; |
386 | if (delta_start < s2MR.end()) { |
387 | s2->mangle_region(delta2_right); |
388 | } |
389 | |
390 | // s1 |
391 | log_develop_trace(gc)(!(LogImpl<(LogTag::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>("Current region: [" PTR_FORMAT"0x%016" "l" "x" ", " PTR_FORMAT"0x%016" "l" "x" ") " |
392 | "New region: [" PTR_FORMAT"0x%016" "l" "x" ", " PTR_FORMAT"0x%016" "l" "x" ")", |
393 | p2i(s1->bottom()), p2i(s1->end()), |
394 | p2i(s1MR.start()), p2i(s1MR.end())); |
395 | log_develop_trace(gc)(!(LogImpl<(LogTag::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" Mangle before: [" PTR_FORMAT"0x%016" "l" "x" ", " |
396 | PTR_FORMAT"0x%016" "l" "x" ") Mangle after: [" PTR_FORMAT"0x%016" "l" "x" ", " PTR_FORMAT"0x%016" "l" "x" ")", |
397 | p2i(delta1_left.start()), p2i(delta1_left.end()), |
398 | p2i(delta1_right.start()), p2i(delta1_right.end())); |
399 | |
400 | // s2 |
401 | log_develop_trace(gc)(!(LogImpl<(LogTag::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>("Current region: [" PTR_FORMAT"0x%016" "l" "x" ", " PTR_FORMAT"0x%016" "l" "x" ") " |
402 | "New region: [" PTR_FORMAT"0x%016" "l" "x" ", " PTR_FORMAT"0x%016" "l" "x" ")", |
403 | p2i(s2->bottom()), p2i(s2->end()), |
404 | p2i(s2MR.start()), p2i(s2MR.end())); |
405 | log_develop_trace(gc)(!(LogImpl<(LogTag::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" Mangle before: [" PTR_FORMAT"0x%016" "l" "x" ", " |
406 | PTR_FORMAT"0x%016" "l" "x" ") Mangle after: [" PTR_FORMAT"0x%016" "l" "x" ", " PTR_FORMAT"0x%016" "l" "x" ")", |
407 | p2i(delta2_left.start()), p2i(delta2_left.end()), |
408 | p2i(delta2_right.start()), p2i(delta2_right.end())); |
409 | } |
410 | #endif // NOT PRODUCT |
411 | |
412 | void PSYoungGen::resize_spaces(size_t requested_eden_size, |
413 | size_t requested_survivor_size) { |
414 | assert(UseAdaptiveSizePolicy, "sanity check")do { if (!(UseAdaptiveSizePolicy)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 414, "assert(" "UseAdaptiveSizePolicy" ") failed", "sanity check" ); ::breakpoint(); } } while (0); |
415 | assert(requested_eden_size > 0 && requested_survivor_size > 0,do { if (!(requested_eden_size > 0 && requested_survivor_size > 0)) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 416, "assert(" "requested_eden_size > 0 && requested_survivor_size > 0" ") failed", "just checking"); ::breakpoint(); } } while (0) |
416 | "just checking")do { if (!(requested_eden_size > 0 && requested_survivor_size > 0)) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 416, "assert(" "requested_eden_size > 0 && requested_survivor_size > 0" ") failed", "just checking"); ::breakpoint(); } } while (0); |
417 | |
418 | // We require eden and to space to be empty |
419 | if ((!eden_space()->is_empty()) || (!to_space()->is_empty())) { |
420 | return; |
421 | } |
422 | |
423 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>("PSYoungGen::resize_spaces(requested_eden_size: " SIZE_FORMAT"%" "l" "u" ", requested_survivor_size: " SIZE_FORMAT"%" "l" "u" ")", |
424 | requested_eden_size, requested_survivor_size); |
425 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" eden: [" PTR_FORMAT"0x%016" "l" "x" ".." PTR_FORMAT"0x%016" "l" "x" ") " SIZE_FORMAT"%" "l" "u", |
426 | p2i(eden_space()->bottom()), |
427 | p2i(eden_space()->end()), |
428 | pointer_delta(eden_space()->end(), |
429 | eden_space()->bottom(), |
430 | sizeof(char))); |
431 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" from: [" PTR_FORMAT"0x%016" "l" "x" ".." PTR_FORMAT"0x%016" "l" "x" ") " SIZE_FORMAT"%" "l" "u", |
432 | p2i(from_space()->bottom()), |
433 | p2i(from_space()->end()), |
434 | pointer_delta(from_space()->end(), |
435 | from_space()->bottom(), |
436 | sizeof(char))); |
437 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" to: [" PTR_FORMAT"0x%016" "l" "x" ".." PTR_FORMAT"0x%016" "l" "x" ") " SIZE_FORMAT"%" "l" "u", |
438 | p2i(to_space()->bottom()), |
439 | p2i(to_space()->end()), |
440 | pointer_delta( to_space()->end(), |
441 | to_space()->bottom(), |
442 | sizeof(char))); |
443 | |
444 | // There's nothing to do if the new sizes are the same as the current |
445 | if (requested_survivor_size == to_space()->capacity_in_bytes() && |
446 | requested_survivor_size == from_space()->capacity_in_bytes() && |
447 | requested_eden_size == eden_space()->capacity_in_bytes()) { |
448 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" capacities are the right sizes, returning"); |
449 | return; |
450 | } |
451 | |
452 | char* eden_start = (char*)eden_space()->bottom(); |
453 | char* eden_end = (char*)eden_space()->end(); |
454 | char* from_start = (char*)from_space()->bottom(); |
455 | char* from_end = (char*)from_space()->end(); |
456 | char* to_start = (char*)to_space()->bottom(); |
457 | char* to_end = (char*)to_space()->end(); |
458 | |
459 | const bool maintain_minimum = |
460 | (requested_eden_size + 2 * requested_survivor_size) <= min_gen_size(); |
461 | |
462 | bool eden_from_to_order = from_start < to_start; |
463 | // Check whether from space is below to space |
464 | if (eden_from_to_order) { |
465 | // Eden, from, to |
466 | eden_from_to_order = true; |
467 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" Eden, from, to:"); |
468 | |
469 | // Set eden |
470 | // "requested_eden_size" is a goal for the size of eden |
471 | // and may not be attainable. "eden_size" below is |
472 | // calculated based on the location of from-space and |
473 | // the goal for the size of eden. from-space is |
474 | // fixed in place because it contains live data. |
475 | // The calculation is done this way to avoid 32bit |
476 | // overflow (i.e., eden_start + requested_eden_size |
477 | // may too large for representation in 32bits). |
478 | size_t eden_size; |
479 | if (maintain_minimum) { |
480 | // Only make eden larger than the requested size if |
481 | // the minimum size of the generation has to be maintained. |
482 | // This could be done in general but policy at a higher |
483 | // level is determining a requested size for eden and that |
484 | // should be honored unless there is a fundamental reason. |
485 | eden_size = pointer_delta(from_start, |
486 | eden_start, |
487 | sizeof(char)); |
488 | } else { |
489 | eden_size = MIN2(requested_eden_size, |
490 | pointer_delta(from_start, eden_start, sizeof(char))); |
491 | } |
492 | |
493 | eden_end = eden_start + eden_size; |
494 | assert(eden_end >= eden_start, "addition overflowed")do { if (!(eden_end >= eden_start)) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 494, "assert(" "eden_end >= eden_start" ") failed", "addition overflowed" ); ::breakpoint(); } } while (0); |
495 | |
496 | // To may resize into from space as long as it is clear of live data. |
497 | // From space must remain page aligned, though, so we need to do some |
498 | // extra calculations. |
499 | |
500 | // First calculate an optimal to-space |
501 | to_end = (char*)virtual_space()->high(); |
502 | to_start = (char*)pointer_delta(to_end, (char*)requested_survivor_size, |
503 | sizeof(char)); |
504 | |
505 | // Does the optimal to-space overlap from-space? |
506 | if (to_start < (char*)from_space()->end()) { |
507 | // Calculate the minimum offset possible for from_end |
508 | size_t from_size = pointer_delta(from_space()->top(), from_start, sizeof(char)); |
509 | |
510 | // Should we be in this method if from_space is empty? Why not the set_space method? FIX ME! |
511 | if (from_size == 0) { |
512 | from_size = SpaceAlignment; |
513 | } else { |
514 | from_size = align_up(from_size, SpaceAlignment); |
515 | } |
516 | |
517 | from_end = from_start + from_size; |
518 | assert(from_end > from_start, "addition overflow or from_size problem")do { if (!(from_end > from_start)) { (*g_assert_poison) = 'X' ;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 518, "assert(" "from_end > from_start" ") failed", "addition overflow or from_size problem" ); ::breakpoint(); } } while (0); |
519 | |
520 | guarantee(from_end <= (char*)from_space()->end(), "from_end moved to the right")do { if (!(from_end <= (char*)from_space()->end())) { ( *g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 520, "guarantee(" "from_end <= (char*)from_space()->end()" ") failed", "from_end moved to the right"); ::breakpoint(); } } while (0); |
521 | |
522 | // Now update to_start with the new from_end |
523 | to_start = MAX2(from_end, to_start); |
524 | } |
525 | |
526 | guarantee(to_start != to_end, "to space is zero sized")do { if (!(to_start != to_end)) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 526, "guarantee(" "to_start != to_end" ") failed", "to space is zero sized" ); ::breakpoint(); } } while (0); |
527 | |
528 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" [eden_start .. eden_end): [" PTR_FORMAT"0x%016" "l" "x" " .. " PTR_FORMAT"0x%016" "l" "x" ") " SIZE_FORMAT"%" "l" "u", |
529 | p2i(eden_start), |
530 | p2i(eden_end), |
531 | pointer_delta(eden_end, eden_start, sizeof(char))); |
532 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" [from_start .. from_end): [" PTR_FORMAT"0x%016" "l" "x" " .. " PTR_FORMAT"0x%016" "l" "x" ") " SIZE_FORMAT"%" "l" "u", |
533 | p2i(from_start), |
534 | p2i(from_end), |
535 | pointer_delta(from_end, from_start, sizeof(char))); |
536 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" [ to_start .. to_end): [" PTR_FORMAT"0x%016" "l" "x" " .. " PTR_FORMAT"0x%016" "l" "x" ") " SIZE_FORMAT"%" "l" "u", |
537 | p2i(to_start), |
538 | p2i(to_end), |
539 | pointer_delta( to_end, to_start, sizeof(char))); |
540 | } else { |
541 | // Eden, to, from |
542 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" Eden, to, from:"); |
543 | |
544 | // To space gets priority over eden resizing. Note that we position |
545 | // to space as if we were able to resize from space, even though from |
546 | // space is not modified. |
547 | // Giving eden priority was tried and gave poorer performance. |
548 | to_end = (char*)pointer_delta(virtual_space()->high(), |
549 | (char*)requested_survivor_size, |
550 | sizeof(char)); |
551 | to_end = MIN2(to_end, from_start); |
552 | to_start = (char*)pointer_delta(to_end, (char*)requested_survivor_size, |
553 | sizeof(char)); |
554 | // if the space sizes are to be increased by several times then |
555 | // 'to_start' will point beyond the young generation. In this case |
556 | // 'to_start' should be adjusted. |
557 | to_start = MAX2(to_start, eden_start + SpaceAlignment); |
558 | |
559 | // Compute how big eden can be, then adjust end. |
560 | // See comments above on calculating eden_end. |
561 | size_t eden_size; |
562 | if (maintain_minimum) { |
563 | eden_size = pointer_delta(to_start, eden_start, sizeof(char)); |
564 | } else { |
565 | eden_size = MIN2(requested_eden_size, |
566 | pointer_delta(to_start, eden_start, sizeof(char))); |
567 | } |
568 | eden_end = eden_start + eden_size; |
569 | assert(eden_end >= eden_start, "addition overflowed")do { if (!(eden_end >= eden_start)) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 569, "assert(" "eden_end >= eden_start" ") failed", "addition overflowed" ); ::breakpoint(); } } while (0); |
570 | |
571 | // Could choose to not let eden shrink |
572 | // to_start = MAX2(to_start, eden_end); |
573 | |
574 | // Don't let eden shrink down to 0 or less. |
575 | eden_end = MAX2(eden_end, eden_start + SpaceAlignment); |
576 | to_start = MAX2(to_start, eden_end); |
577 | |
578 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" [eden_start .. eden_end): [" PTR_FORMAT"0x%016" "l" "x" " .. " PTR_FORMAT"0x%016" "l" "x" ") " SIZE_FORMAT"%" "l" "u", |
579 | p2i(eden_start), |
580 | p2i(eden_end), |
581 | pointer_delta(eden_end, eden_start, sizeof(char))); |
582 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" [ to_start .. to_end): [" PTR_FORMAT"0x%016" "l" "x" " .. " PTR_FORMAT"0x%016" "l" "x" ") " SIZE_FORMAT"%" "l" "u", |
583 | p2i(to_start), |
584 | p2i(to_end), |
585 | pointer_delta( to_end, to_start, sizeof(char))); |
586 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>(" [from_start .. from_end): [" PTR_FORMAT"0x%016" "l" "x" " .. " PTR_FORMAT"0x%016" "l" "x" ") " SIZE_FORMAT"%" "l" "u", |
587 | p2i(from_start), |
588 | p2i(from_end), |
589 | pointer_delta(from_end, from_start, sizeof(char))); |
590 | } |
591 | |
592 | |
593 | guarantee((HeapWord*)from_start <= from_space()->bottom(),do { if (!((HeapWord*)from_start <= from_space()->bottom ())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 594, "guarantee(" "(HeapWord*)from_start <= from_space()->bottom()" ") failed", "from start moved to the right"); ::breakpoint() ; } } while (0) |
594 | "from start moved to the right")do { if (!((HeapWord*)from_start <= from_space()->bottom ())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 594, "guarantee(" "(HeapWord*)from_start <= from_space()->bottom()" ") failed", "from start moved to the right"); ::breakpoint() ; } } while (0); |
595 | guarantee((HeapWord*)from_end >= from_space()->top(),do { if (!((HeapWord*)from_end >= from_space()->top())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 596, "guarantee(" "(HeapWord*)from_end >= from_space()->top()" ") failed", "from end moved into live data"); ::breakpoint() ; } } while (0) |
596 | "from end moved into live data")do { if (!((HeapWord*)from_end >= from_space()->top())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 596, "guarantee(" "(HeapWord*)from_end >= from_space()->top()" ") failed", "from end moved into live data"); ::breakpoint() ; } } while (0); |
597 | assert(is_object_aligned(eden_start), "checking alignment")do { if (!(is_object_aligned(eden_start))) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 597, "assert(" "is_object_aligned(eden_start)" ") failed", "checking alignment" ); ::breakpoint(); } } while (0); |
598 | assert(is_object_aligned(from_start), "checking alignment")do { if (!(is_object_aligned(from_start))) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 598, "assert(" "is_object_aligned(from_start)" ") failed", "checking alignment" ); ::breakpoint(); } } while (0); |
599 | assert(is_object_aligned(to_start), "checking alignment")do { if (!(is_object_aligned(to_start))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 599, "assert(" "is_object_aligned(to_start)" ") failed", "checking alignment" ); ::breakpoint(); } } while (0); |
600 | |
601 | MemRegion edenMR((HeapWord*)eden_start, (HeapWord*)eden_end); |
602 | MemRegion toMR ((HeapWord*)to_start, (HeapWord*)to_end); |
603 | MemRegion fromMR((HeapWord*)from_start, (HeapWord*)from_end); |
604 | |
605 | // Let's make sure the call to initialize doesn't reset "top"! |
606 | HeapWord* old_from_top = from_space()->top(); |
607 | |
608 | // For logging block below |
609 | size_t old_from = from_space()->capacity_in_bytes(); |
610 | size_t old_to = to_space()->capacity_in_bytes(); |
611 | |
612 | if (ZapUnusedHeapArea) { |
613 | // NUMA is a special case because a numa space is not mangled |
614 | // in order to not prematurely bind its address to memory to |
615 | // the wrong memory (i.e., don't want the GC thread to first |
616 | // touch the memory). The survivor spaces are not numa |
617 | // spaces and are mangled. |
618 | if (UseNUMA) { |
619 | if (eden_from_to_order) { |
620 | mangle_survivors(from_space(), fromMR, to_space(), toMR); |
621 | } else { |
622 | mangle_survivors(to_space(), toMR, from_space(), fromMR); |
623 | } |
624 | } |
625 | |
626 | // If not mangling the spaces, do some checking to verify that |
627 | // the spaces are already mangled. |
628 | // The spaces should be correctly mangled at this point so |
629 | // do some checking here. Note that they are not being mangled |
630 | // in the calls to initialize(). |
631 | // Must check mangling before the spaces are reshaped. Otherwise, |
632 | // the bottom or end of one space may have moved into an area |
633 | // covered by another space and a failure of the check may |
634 | // not correctly indicate which space is not properly mangled. |
635 | HeapWord* limit = (HeapWord*) virtual_space()->high(); |
636 | eden_space()->check_mangled_unused_area(limit); |
637 | from_space()->check_mangled_unused_area(limit); |
638 | to_space()->check_mangled_unused_area(limit); |
639 | } |
640 | |
641 | WorkerThreads* workers = &ParallelScavengeHeap::heap()->workers(); |
642 | |
643 | // When an existing space is being initialized, it is not |
644 | // mangled because the space has been previously mangled. |
645 | eden_space()->initialize(edenMR, |
646 | SpaceDecorator::Clear, |
647 | SpaceDecorator::DontMangle, |
648 | MutableSpace::SetupPages, |
649 | workers); |
650 | to_space()->initialize(toMR, |
651 | SpaceDecorator::Clear, |
652 | SpaceDecorator::DontMangle, |
653 | MutableSpace::SetupPages, |
654 | workers); |
655 | from_space()->initialize(fromMR, |
656 | SpaceDecorator::DontClear, |
657 | SpaceDecorator::DontMangle, |
658 | MutableSpace::SetupPages, |
659 | workers); |
660 | |
661 | assert(from_space()->top() == old_from_top, "from top changed!")do { if (!(from_space()->top() == old_from_top)) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 661, "assert(" "from_space()->top() == old_from_top" ") failed" , "from top changed!"); ::breakpoint(); } } while (0); |
662 | |
663 | log_trace(gc, ergo)(!(LogImpl<(LogTag::_gc), (LogTag::_ergo), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG), (LogTag::__NO_TAG) >::is_level(LogLevel::Trace))) ? (void)0 : LogImpl<(LogTag ::_gc), (LogTag::_ergo), (LogTag::__NO_TAG), (LogTag::__NO_TAG ), (LogTag::__NO_TAG), (LogTag::__NO_TAG)>::write<LogLevel ::Trace>("AdaptiveSizePolicy::survivor space sizes: collection: %d (" SIZE_FORMAT"%" "l" "u" ", " SIZE_FORMAT"%" "l" "u" ") -> (" SIZE_FORMAT"%" "l" "u" ", " SIZE_FORMAT"%" "l" "u" ") ", |
664 | ParallelScavengeHeap::heap()->total_collections(), |
665 | old_from, old_to, |
666 | from_space()->capacity_in_bytes(), |
667 | to_space()->capacity_in_bytes()); |
668 | } |
669 | |
670 | void PSYoungGen::swap_spaces() { |
671 | MutableSpace* s = from_space(); |
672 | _from_space = to_space(); |
673 | _to_space = s; |
674 | } |
675 | |
676 | size_t PSYoungGen::capacity_in_bytes() const { |
677 | return eden_space()->capacity_in_bytes() |
678 | + from_space()->capacity_in_bytes(); // to_space() is only used during scavenge |
679 | } |
680 | |
681 | |
682 | size_t PSYoungGen::used_in_bytes() const { |
683 | return eden_space()->used_in_bytes() |
684 | + from_space()->used_in_bytes(); // to_space() is only used during scavenge |
685 | } |
686 | |
687 | |
688 | size_t PSYoungGen::free_in_bytes() const { |
689 | return eden_space()->free_in_bytes() |
690 | + from_space()->free_in_bytes(); // to_space() is only used during scavenge |
691 | } |
692 | |
693 | size_t PSYoungGen::capacity_in_words() const { |
694 | return eden_space()->capacity_in_words() |
695 | + from_space()->capacity_in_words(); // to_space() is only used during scavenge |
696 | } |
697 | |
698 | |
699 | size_t PSYoungGen::used_in_words() const { |
700 | return eden_space()->used_in_words() |
701 | + from_space()->used_in_words(); // to_space() is only used during scavenge |
702 | } |
703 | |
704 | |
705 | size_t PSYoungGen::free_in_words() const { |
706 | return eden_space()->free_in_words() |
707 | + from_space()->free_in_words(); // to_space() is only used during scavenge |
708 | } |
709 | |
710 | void PSYoungGen::object_iterate(ObjectClosure* blk) { |
711 | eden_space()->object_iterate(blk); |
712 | from_space()->object_iterate(blk); |
713 | to_space()->object_iterate(blk); |
714 | } |
715 | |
716 | void PSYoungGen::print() const { print_on(tty); } |
717 | void PSYoungGen::print_on(outputStream* st) const { |
718 | st->print(" %-15s", "PSYoungGen"); |
719 | st->print(" total " SIZE_FORMAT"%" "l" "u" "K, used " SIZE_FORMAT"%" "l" "u" "K", |
720 | capacity_in_bytes()/K, used_in_bytes()/K); |
721 | virtual_space()->print_space_boundaries_on(st); |
722 | st->print(" eden"); eden_space()->print_on(st); |
723 | st->print(" from"); from_space()->print_on(st); |
724 | st->print(" to "); to_space()->print_on(st); |
725 | } |
726 | |
727 | size_t PSYoungGen::available_to_min_gen() { |
728 | assert(virtual_space()->committed_size() >= min_gen_size(), "Invariant")do { if (!(virtual_space()->committed_size() >= min_gen_size ())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 728, "assert(" "virtual_space()->committed_size() >= min_gen_size()" ") failed", "Invariant"); ::breakpoint(); } } while (0); |
729 | return virtual_space()->committed_size() - min_gen_size(); |
730 | } |
731 | |
732 | // This method assumes that from-space has live data and that |
733 | // any shrinkage of the young gen is limited by location of |
734 | // from-space. |
735 | size_t PSYoungGen::available_to_live() { |
736 | size_t delta_in_survivor = 0; |
737 | MutableSpace* space_shrinking = NULL__null; |
738 | if (from_space()->end() > to_space()->end()) { |
739 | space_shrinking = from_space(); |
740 | } else { |
741 | space_shrinking = to_space(); |
742 | } |
743 | |
744 | // Include any space that is committed but not included in |
745 | // the survivor spaces. |
746 | assert(((HeapWord*)virtual_space()->high()) >= space_shrinking->end(),do { if (!(((HeapWord*)virtual_space()->high()) >= space_shrinking ->end())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 747, "assert(" "((HeapWord*)virtual_space()->high()) >= space_shrinking->end()" ") failed", "Survivor space beyond high end"); ::breakpoint( ); } } while (0) |
747 | "Survivor space beyond high end")do { if (!(((HeapWord*)virtual_space()->high()) >= space_shrinking ->end())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 747, "assert(" "((HeapWord*)virtual_space()->high()) >= space_shrinking->end()" ") failed", "Survivor space beyond high end"); ::breakpoint( ); } } while (0); |
748 | size_t unused_committed = pointer_delta(virtual_space()->high(), |
749 | space_shrinking->end(), sizeof(char)); |
750 | |
751 | if (space_shrinking->is_empty()) { |
752 | // Don't let the space shrink to 0 |
753 | assert(space_shrinking->capacity_in_bytes() >= SpaceAlignment,do { if (!(space_shrinking->capacity_in_bytes() >= SpaceAlignment )) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 754, "assert(" "space_shrinking->capacity_in_bytes() >= SpaceAlignment" ") failed", "Space is too small"); ::breakpoint(); } } while (0) |
754 | "Space is too small")do { if (!(space_shrinking->capacity_in_bytes() >= SpaceAlignment )) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 754, "assert(" "space_shrinking->capacity_in_bytes() >= SpaceAlignment" ") failed", "Space is too small"); ::breakpoint(); } } while (0); |
755 | delta_in_survivor = space_shrinking->capacity_in_bytes() - SpaceAlignment; |
756 | } else { |
757 | delta_in_survivor = pointer_delta(space_shrinking->end(), |
758 | space_shrinking->top(), |
759 | sizeof(char)); |
760 | } |
761 | |
762 | size_t delta_in_bytes = unused_committed + delta_in_survivor; |
763 | delta_in_bytes = align_down(delta_in_bytes, GenAlignment); |
764 | return delta_in_bytes; |
765 | } |
766 | |
767 | // Return the number of bytes available for resizing down the young |
768 | // generation. This is the minimum of |
769 | // input "bytes" |
770 | // bytes to the minimum young gen size |
771 | // bytes to the size currently being used + some small extra |
772 | size_t PSYoungGen::limit_gen_shrink(size_t bytes) { |
773 | // Allow shrinkage into the current eden but keep eden large enough |
774 | // to maintain the minimum young gen size |
775 | bytes = MIN3(bytes, available_to_min_gen(), available_to_live()); |
776 | return align_down(bytes, virtual_space()->alignment()); |
777 | } |
778 | |
779 | void PSYoungGen::reset_survivors_after_shrink() { |
780 | _reserved = MemRegion((HeapWord*)virtual_space()->low_boundary(), |
781 | (HeapWord*)virtual_space()->high_boundary()); |
782 | PSScavenge::set_subject_to_discovery_span(_reserved); |
783 | |
784 | MutableSpace* space_shrinking = NULL__null; |
785 | if (from_space()->end() > to_space()->end()) { |
786 | space_shrinking = from_space(); |
787 | } else { |
788 | space_shrinking = to_space(); |
789 | } |
790 | |
791 | HeapWord* new_end = (HeapWord*)virtual_space()->high(); |
792 | assert(new_end >= space_shrinking->bottom(), "Shrink was too large")do { if (!(new_end >= space_shrinking->bottom())) { (*g_assert_poison ) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 792, "assert(" "new_end >= space_shrinking->bottom()" ") failed", "Shrink was too large"); ::breakpoint(); } } while (0); |
793 | // Was there a shrink of the survivor space? |
794 | if (new_end < space_shrinking->end()) { |
795 | MemRegion mr(space_shrinking->bottom(), new_end); |
796 | |
797 | space_shrinking->initialize(mr, |
798 | SpaceDecorator::DontClear, |
799 | SpaceDecorator::Mangle, |
800 | MutableSpace::SetupPages, |
801 | &ParallelScavengeHeap::heap()->workers()); |
802 | } |
803 | } |
804 | |
805 | // This method currently does not expect to expand into eden (i.e., |
806 | // the virtual space boundaries is expected to be consistent |
807 | // with the eden boundaries.. |
808 | void PSYoungGen::post_resize() { |
809 | assert_locked_or_safepoint(Heap_lock); |
810 | assert((eden_space()->bottom() < to_space()->bottom()) &&do { if (!((eden_space()->bottom() < to_space()->bottom ()) && (eden_space()->bottom() < from_space()-> bottom()))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 812, "assert(" "(eden_space()->bottom() < to_space()->bottom()) && (eden_space()->bottom() < from_space()->bottom())" ") failed", "Eden is assumed to be below the survivor spaces" ); ::breakpoint(); } } while (0) |
811 | (eden_space()->bottom() < from_space()->bottom()),do { if (!((eden_space()->bottom() < to_space()->bottom ()) && (eden_space()->bottom() < from_space()-> bottom()))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 812, "assert(" "(eden_space()->bottom() < to_space()->bottom()) && (eden_space()->bottom() < from_space()->bottom())" ") failed", "Eden is assumed to be below the survivor spaces" ); ::breakpoint(); } } while (0) |
812 | "Eden is assumed to be below the survivor spaces")do { if (!((eden_space()->bottom() < to_space()->bottom ()) && (eden_space()->bottom() < from_space()-> bottom()))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 812, "assert(" "(eden_space()->bottom() < to_space()->bottom()) && (eden_space()->bottom() < from_space()->bottom())" ") failed", "Eden is assumed to be below the survivor spaces" ); ::breakpoint(); } } while (0); |
813 | |
814 | MemRegion cmr((HeapWord*)virtual_space()->low(), |
815 | (HeapWord*)virtual_space()->high()); |
816 | ParallelScavengeHeap::heap()->card_table()->resize_covered_region(cmr); |
817 | space_invariants(); |
818 | } |
819 | |
820 | |
821 | |
822 | void PSYoungGen::update_counters() { |
823 | if (UsePerfData) { |
824 | _eden_counters->update_all(); |
825 | _from_counters->update_all(); |
826 | _to_counters->update_all(); |
827 | _gen_counters->update_all(); |
828 | } |
829 | } |
830 | |
831 | void PSYoungGen::verify() { |
832 | eden_space()->verify(); |
833 | from_space()->verify(); |
834 | to_space()->verify(); |
835 | } |
836 | |
837 | #ifndef PRODUCT |
838 | void PSYoungGen::record_spaces_top() { |
839 | assert(ZapUnusedHeapArea, "Not mangling unused space")do { if (!(ZapUnusedHeapArea)) { (*g_assert_poison) = 'X';; report_vm_error ("/home/daniel/Projects/java/jdk/src/hotspot/share/gc/parallel/psYoungGen.cpp" , 839, "assert(" "ZapUnusedHeapArea" ") failed", "Not mangling unused space" ); ::breakpoint(); } } while (0); |
840 | eden_space()->set_top_for_allocations(); |
841 | from_space()->set_top_for_allocations(); |
842 | to_space()->set_top_for_allocations(); |
843 | } |
844 | #endif |