comparison src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children 183f41cf8bfe
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 /*
2 * Copyright 2005-2006 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 # include "incls/_precompiled.incl"
26 # include "incls/_asParNewGeneration.cpp.incl"
27
28 ASParNewGeneration::ASParNewGeneration(ReservedSpace rs,
29 size_t initial_byte_size,
30 size_t min_byte_size,
31 int level) :
32 ParNewGeneration(rs, initial_byte_size, level),
33 _min_gen_size(min_byte_size) {}
34
35 const char* ASParNewGeneration::name() const {
36 return "adaptive size par new generation";
37 }
38
39 void ASParNewGeneration::adjust_desired_tenuring_threshold() {
40 assert(UseAdaptiveSizePolicy,
41 "Should only be used with UseAdaptiveSizePolicy");
42 }
43
44 void ASParNewGeneration::resize(size_t eden_size, size_t survivor_size) {
45 // Resize the generation if needed. If the generation resize
46 // reports false, do not attempt to resize the spaces.
47 if (resize_generation(eden_size, survivor_size)) {
48 // Then we lay out the spaces inside the generation
49 resize_spaces(eden_size, survivor_size);
50
51 space_invariants();
52
53 if (PrintAdaptiveSizePolicy && Verbose) {
54 gclog_or_tty->print_cr("Young generation size: "
55 "desired eden: " SIZE_FORMAT " survivor: " SIZE_FORMAT
56 " used: " SIZE_FORMAT " capacity: " SIZE_FORMAT
57 " gen limits: " SIZE_FORMAT " / " SIZE_FORMAT,
58 eden_size, survivor_size, used(), capacity(),
59 max_gen_size(), min_gen_size());
60 }
61 }
62 }
63
64 size_t ASParNewGeneration::available_to_min_gen() {
65 assert(virtual_space()->committed_size() >= min_gen_size(), "Invariant");
66 return virtual_space()->committed_size() - min_gen_size();
67 }
68
69 // This method assumes that from-space has live data and that
70 // any shrinkage of the young gen is limited by location of
71 // from-space.
72 size_t ASParNewGeneration::available_to_live() const {
73 #undef SHRINKS_AT_END_OF_EDEN
74 #ifdef SHRINKS_AT_END_OF_EDEN
75 size_t delta_in_survivor = 0;
76 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
77 const size_t space_alignment = heap->intra_generation_alignment();
78 const size_t gen_alignment = heap->generation_alignment();
79
80 MutableSpace* space_shrinking = NULL;
81 if (from_space()->end() > to_space()->end()) {
82 space_shrinking = from_space();
83 } else {
84 space_shrinking = to_space();
85 }
86
87 // Include any space that is committed but not included in
88 // the survivor spaces.
89 assert(((HeapWord*)virtual_space()->high()) >= space_shrinking->end(),
90 "Survivor space beyond high end");
91 size_t unused_committed = pointer_delta(virtual_space()->high(),
92 space_shrinking->end(), sizeof(char));
93
94 if (space_shrinking->is_empty()) {
95 // Don't let the space shrink to 0
96 assert(space_shrinking->capacity_in_bytes() >= space_alignment,
97 "Space is too small");
98 delta_in_survivor = space_shrinking->capacity_in_bytes() - space_alignment;
99 } else {
100 delta_in_survivor = pointer_delta(space_shrinking->end(),
101 space_shrinking->top(),
102 sizeof(char));
103 }
104
105 size_t delta_in_bytes = unused_committed + delta_in_survivor;
106 delta_in_bytes = align_size_down(delta_in_bytes, gen_alignment);
107 return delta_in_bytes;
108 #else
109 // The only space available for shrinking is in to-space if it
110 // is above from-space.
111 if (to()->bottom() > from()->bottom()) {
112 const size_t alignment = os::vm_page_size();
113 if (to()->capacity() < alignment) {
114 return 0;
115 } else {
116 return to()->capacity() - alignment;
117 }
118 } else {
119 return 0;
120 }
121 #endif
122 }
123
124 // Return the number of bytes available for resizing down the young
125 // generation. This is the minimum of
126 // input "bytes"
127 // bytes to the minimum young gen size
128 // bytes to the size currently being used + some small extra
129 size_t ASParNewGeneration::limit_gen_shrink (size_t bytes) {
130 // Allow shrinkage into the current eden but keep eden large enough
131 // to maintain the minimum young gen size
132 bytes = MIN3(bytes, available_to_min_gen(), available_to_live());
133 return align_size_down(bytes, os::vm_page_size());
134 }
135
136 // Note that the the alignment used is the OS page size as
137 // opposed to an alignment associated with the virtual space
138 // (as is done in the ASPSYoungGen/ASPSOldGen)
139 bool ASParNewGeneration::resize_generation(size_t eden_size,
140 size_t survivor_size) {
141 const size_t alignment = os::vm_page_size();
142 size_t orig_size = virtual_space()->committed_size();
143 bool size_changed = false;
144
145 // There used to be this guarantee there.
146 // guarantee ((eden_size + 2*survivor_size) <= _max_gen_size, "incorrect input arguments");
147 // Code below forces this requirement. In addition the desired eden
148 // size and disired survivor sizes are desired goals and may
149 // exceed the total generation size.
150
151 assert(min_gen_size() <= orig_size && orig_size <= max_gen_size(),
152 "just checking");
153
154 // Adjust new generation size
155 const size_t eden_plus_survivors =
156 align_size_up(eden_size + 2 * survivor_size, alignment);
157 size_t desired_size = MAX2(MIN2(eden_plus_survivors, max_gen_size()),
158 min_gen_size());
159 assert(desired_size <= max_gen_size(), "just checking");
160
161 if (desired_size > orig_size) {
162 // Grow the generation
163 size_t change = desired_size - orig_size;
164 assert(change % alignment == 0, "just checking");
165 if (!virtual_space()->expand_by(change)) {
166 return false; // Error if we fail to resize!
167 }
168
169 size_changed = true;
170 } else if (desired_size < orig_size) {
171 size_t desired_change = orig_size - desired_size;
172 assert(desired_change % alignment == 0, "just checking");
173
174 desired_change = limit_gen_shrink(desired_change);
175
176 if (desired_change > 0) {
177 virtual_space()->shrink_by(desired_change);
178 reset_survivors_after_shrink();
179
180 size_changed = true;
181 }
182 } else {
183 if (Verbose && PrintGC) {
184 if (orig_size == max_gen_size()) {
185 gclog_or_tty->print_cr("ASParNew generation size at maximum: "
186 SIZE_FORMAT "K", orig_size/K);
187 } else if (orig_size == min_gen_size()) {
188 gclog_or_tty->print_cr("ASParNew generation size at minium: "
189 SIZE_FORMAT "K", orig_size/K);
190 }
191 }
192 }
193
194 if (size_changed) {
195 MemRegion cmr((HeapWord*)virtual_space()->low(),
196 (HeapWord*)virtual_space()->high());
197 GenCollectedHeap::heap()->barrier_set()->resize_covered_region(cmr);
198
199 if (Verbose && PrintGC) {
200 size_t current_size = virtual_space()->committed_size();
201 gclog_or_tty->print_cr("ASParNew generation size changed: "
202 SIZE_FORMAT "K->" SIZE_FORMAT "K",
203 orig_size/K, current_size/K);
204 }
205 }
206
207 guarantee(eden_plus_survivors <= virtual_space()->committed_size() ||
208 virtual_space()->committed_size() == max_gen_size(), "Sanity");
209
210 return true;
211 }
212
213 void ASParNewGeneration::reset_survivors_after_shrink() {
214
215 GenCollectedHeap* gch = GenCollectedHeap::heap();
216 HeapWord* new_end = (HeapWord*)virtual_space()->high();
217
218 if (from()->end() > to()->end()) {
219 assert(new_end >= from()->end(), "Shrinking past from-space");
220 } else {
221 assert(new_end >= to()->bottom(), "Shrink was too large");
222 // Was there a shrink of the survivor space?
223 if (new_end < to()->end()) {
224 MemRegion mr(to()->bottom(), new_end);
225 to()->initialize(mr, false /* clear */);
226 }
227 }
228 }
229 void ASParNewGeneration::resize_spaces(size_t requested_eden_size,
230 size_t requested_survivor_size) {
231 assert(UseAdaptiveSizePolicy, "sanity check");
232 assert(requested_eden_size > 0 && requested_survivor_size > 0,
233 "just checking");
234 CollectedHeap* heap = Universe::heap();
235 assert(heap->kind() == CollectedHeap::GenCollectedHeap, "Sanity");
236
237
238 // We require eden and to space to be empty
239 if ((!eden()->is_empty()) || (!to()->is_empty())) {
240 return;
241 }
242
243 size_t cur_eden_size = eden()->capacity();
244
245 if (PrintAdaptiveSizePolicy && Verbose) {
246 gclog_or_tty->print_cr("ASParNew::resize_spaces(requested_eden_size: "
247 SIZE_FORMAT
248 ", requested_survivor_size: " SIZE_FORMAT ")",
249 requested_eden_size, requested_survivor_size);
250 gclog_or_tty->print_cr(" eden: [" PTR_FORMAT ".." PTR_FORMAT ") "
251 SIZE_FORMAT,
252 eden()->bottom(),
253 eden()->end(),
254 pointer_delta(eden()->end(),
255 eden()->bottom(),
256 sizeof(char)));
257 gclog_or_tty->print_cr(" from: [" PTR_FORMAT ".." PTR_FORMAT ") "
258 SIZE_FORMAT,
259 from()->bottom(),
260 from()->end(),
261 pointer_delta(from()->end(),
262 from()->bottom(),
263 sizeof(char)));
264 gclog_or_tty->print_cr(" to: [" PTR_FORMAT ".." PTR_FORMAT ") "
265 SIZE_FORMAT,
266 to()->bottom(),
267 to()->end(),
268 pointer_delta( to()->end(),
269 to()->bottom(),
270 sizeof(char)));
271 }
272
273 // There's nothing to do if the new sizes are the same as the current
274 if (requested_survivor_size == to()->capacity() &&
275 requested_survivor_size == from()->capacity() &&
276 requested_eden_size == eden()->capacity()) {
277 if (PrintAdaptiveSizePolicy && Verbose) {
278 gclog_or_tty->print_cr(" capacities are the right sizes, returning");
279 }
280 return;
281 }
282
283 char* eden_start = (char*)eden()->bottom();
284 char* eden_end = (char*)eden()->end();
285 char* from_start = (char*)from()->bottom();
286 char* from_end = (char*)from()->end();
287 char* to_start = (char*)to()->bottom();
288 char* to_end = (char*)to()->end();
289
290 const size_t alignment = os::vm_page_size();
291 const bool maintain_minimum =
292 (requested_eden_size + 2 * requested_survivor_size) <= min_gen_size();
293
294 // Check whether from space is below to space
295 if (from_start < to_start) {
296 // Eden, from, to
297 if (PrintAdaptiveSizePolicy && Verbose) {
298 gclog_or_tty->print_cr(" Eden, from, to:");
299 }
300
301 // Set eden
302 // "requested_eden_size" is a goal for the size of eden
303 // and may not be attainable. "eden_size" below is
304 // calculated based on the location of from-space and
305 // the goal for the size of eden. from-space is
306 // fixed in place because it contains live data.
307 // The calculation is done this way to avoid 32bit
308 // overflow (i.e., eden_start + requested_eden_size
309 // may too large for representation in 32bits).
310 size_t eden_size;
311 if (maintain_minimum) {
312 // Only make eden larger than the requested size if
313 // the minimum size of the generation has to be maintained.
314 // This could be done in general but policy at a higher
315 // level is determining a requested size for eden and that
316 // should be honored unless there is a fundamental reason.
317 eden_size = pointer_delta(from_start,
318 eden_start,
319 sizeof(char));
320 } else {
321 eden_size = MIN2(requested_eden_size,
322 pointer_delta(from_start, eden_start, sizeof(char)));
323 }
324
325 // tty->print_cr("eden_size before: " SIZE_FORMAT, eden_size);
326 eden_size = align_size_down(eden_size, alignment);
327 // tty->print_cr("eden_size after: " SIZE_FORMAT, eden_size);
328 eden_end = eden_start + eden_size;
329 assert(eden_end >= eden_start, "addition overflowed")
330
331 // To may resize into from space as long as it is clear of live data.
332 // From space must remain page aligned, though, so we need to do some
333 // extra calculations.
334
335 // First calculate an optimal to-space
336 to_end = (char*)virtual_space()->high();
337 to_start = (char*)pointer_delta(to_end, (char*)requested_survivor_size,
338 sizeof(char));
339
340 // Does the optimal to-space overlap from-space?
341 if (to_start < (char*)from()->end()) {
342 // Calculate the minimum offset possible for from_end
343 size_t from_size = pointer_delta(from()->top(), from_start, sizeof(char));
344
345 // Should we be in this method if from_space is empty? Why not the set_space method? FIX ME!
346 if (from_size == 0) {
347 from_size = alignment;
348 } else {
349 from_size = align_size_up(from_size, alignment);
350 }
351
352 from_end = from_start + from_size;
353 assert(from_end > from_start, "addition overflow or from_size problem");
354
355 guarantee(from_end <= (char*)from()->end(), "from_end moved to the right");
356
357 // Now update to_start with the new from_end
358 to_start = MAX2(from_end, to_start);
359 } else {
360 // If shrinking, move to-space down to abut the end of from-space
361 // so that shrinking will move to-space down. If not shrinking
362 // to-space is moving up to allow for growth on the next expansion.
363 if (requested_eden_size <= cur_eden_size) {
364 to_start = from_end;
365 if (to_start + requested_survivor_size > to_start) {
366 to_end = to_start + requested_survivor_size;
367 }
368 }
369 // else leave to_end pointing to the high end of the virtual space.
370 }
371
372 guarantee(to_start != to_end, "to space is zero sized");
373
374 if (PrintAdaptiveSizePolicy && Verbose) {
375 gclog_or_tty->print_cr(" [eden_start .. eden_end): "
376 "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
377 eden_start,
378 eden_end,
379 pointer_delta(eden_end, eden_start, sizeof(char)));
380 gclog_or_tty->print_cr(" [from_start .. from_end): "
381 "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
382 from_start,
383 from_end,
384 pointer_delta(from_end, from_start, sizeof(char)));
385 gclog_or_tty->print_cr(" [ to_start .. to_end): "
386 "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
387 to_start,
388 to_end,
389 pointer_delta( to_end, to_start, sizeof(char)));
390 }
391 } else {
392 // Eden, to, from
393 if (PrintAdaptiveSizePolicy && Verbose) {
394 gclog_or_tty->print_cr(" Eden, to, from:");
395 }
396
397 // Calculate the to-space boundaries based on
398 // the start of from-space.
399 to_end = from_start;
400 to_start = (char*)pointer_delta(from_start,
401 (char*)requested_survivor_size,
402 sizeof(char));
403 // Calculate the ideal eden boundaries.
404 // eden_end is already at the bottom of the generation
405 assert(eden_start == virtual_space()->low(),
406 "Eden is not starting at the low end of the virtual space");
407 if (eden_start + requested_eden_size >= eden_start) {
408 eden_end = eden_start + requested_eden_size;
409 } else {
410 eden_end = to_start;
411 }
412
413 // Does eden intrude into to-space? to-space
414 // gets priority but eden is not allowed to shrink
415 // to 0.
416 if (eden_end > to_start) {
417 eden_end = to_start;
418 }
419
420 // Don't let eden shrink down to 0 or less.
421 eden_end = MAX2(eden_end, eden_start + alignment);
422 assert(eden_start + alignment >= eden_start, "Overflow");
423
424 size_t eden_size;
425 if (maintain_minimum) {
426 // Use all the space available.
427 eden_end = MAX2(eden_end, to_start);
428 eden_size = pointer_delta(eden_end, eden_start, sizeof(char));
429 eden_size = MIN2(eden_size, cur_eden_size);
430 } else {
431 eden_size = pointer_delta(eden_end, eden_start, sizeof(char));
432 }
433 eden_size = align_size_down(eden_size, alignment);
434 assert(maintain_minimum || eden_size <= requested_eden_size,
435 "Eden size is too large");
436 assert(eden_size >= alignment, "Eden size is too small");
437 eden_end = eden_start + eden_size;
438
439 // Move to-space down to eden.
440 if (requested_eden_size < cur_eden_size) {
441 to_start = eden_end;
442 if (to_start + requested_survivor_size > to_start) {
443 to_end = MIN2(from_start, to_start + requested_survivor_size);
444 } else {
445 to_end = from_start;
446 }
447 }
448
449 // eden_end may have moved so again make sure
450 // the to-space and eden don't overlap.
451 to_start = MAX2(eden_end, to_start);
452
453 // from-space
454 size_t from_used = from()->used();
455 if (requested_survivor_size > from_used) {
456 if (from_start + requested_survivor_size >= from_start) {
457 from_end = from_start + requested_survivor_size;
458 }
459 if (from_end > virtual_space()->high()) {
460 from_end = virtual_space()->high();
461 }
462 }
463
464 assert(to_start >= eden_end, "to-space should be above eden");
465 if (PrintAdaptiveSizePolicy && Verbose) {
466 gclog_or_tty->print_cr(" [eden_start .. eden_end): "
467 "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
468 eden_start,
469 eden_end,
470 pointer_delta(eden_end, eden_start, sizeof(char)));
471 gclog_or_tty->print_cr(" [ to_start .. to_end): "
472 "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
473 to_start,
474 to_end,
475 pointer_delta( to_end, to_start, sizeof(char)));
476 gclog_or_tty->print_cr(" [from_start .. from_end): "
477 "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
478 from_start,
479 from_end,
480 pointer_delta(from_end, from_start, sizeof(char)));
481 }
482 }
483
484
485 guarantee((HeapWord*)from_start <= from()->bottom(),
486 "from start moved to the right");
487 guarantee((HeapWord*)from_end >= from()->top(),
488 "from end moved into live data");
489 assert(is_object_aligned((intptr_t)eden_start), "checking alignment");
490 assert(is_object_aligned((intptr_t)from_start), "checking alignment");
491 assert(is_object_aligned((intptr_t)to_start), "checking alignment");
492
493 MemRegion edenMR((HeapWord*)eden_start, (HeapWord*)eden_end);
494 MemRegion toMR ((HeapWord*)to_start, (HeapWord*)to_end);
495 MemRegion fromMR((HeapWord*)from_start, (HeapWord*)from_end);
496
497 // Let's make sure the call to initialize doesn't reset "top"!
498 HeapWord* old_from_top = from()->top();
499
500 // For PrintAdaptiveSizePolicy block below
501 size_t old_from = from()->capacity();
502 size_t old_to = to()->capacity();
503
504 // The call to initialize NULL's the next compaction space
505 eden()->initialize(edenMR, true);
506 eden()->set_next_compaction_space(from());
507 to()->initialize(toMR , true);
508 from()->initialize(fromMR, false); // Note, not cleared!
509
510 assert(from()->top() == old_from_top, "from top changed!");
511
512 if (PrintAdaptiveSizePolicy) {
513 GenCollectedHeap* gch = GenCollectedHeap::heap();
514 assert(gch->kind() == CollectedHeap::GenCollectedHeap, "Sanity");
515
516 gclog_or_tty->print("AdaptiveSizePolicy::survivor space sizes: "
517 "collection: %d "
518 "(" SIZE_FORMAT ", " SIZE_FORMAT ") -> "
519 "(" SIZE_FORMAT ", " SIZE_FORMAT ") ",
520 gch->total_collections(),
521 old_from, old_to,
522 from()->capacity(),
523 to()->capacity());
524 gclog_or_tty->cr();
525 }
526 }
527
528 void ASParNewGeneration::compute_new_size() {
529 GenCollectedHeap* gch = GenCollectedHeap::heap();
530 assert(gch->kind() == CollectedHeap::GenCollectedHeap,
531 "not a CMS generational heap");
532
533
534 CMSAdaptiveSizePolicy* size_policy =
535 (CMSAdaptiveSizePolicy*)gch->gen_policy()->size_policy();
536 assert(size_policy->is_gc_cms_adaptive_size_policy(),
537 "Wrong type of size policy");
538
539 size_t survived = from()->used();
540 if (!survivor_overflow()) {
541 // Keep running averages on how much survived
542 size_policy->avg_survived()->sample(survived);
543 } else {
544 size_t promoted =
545 (size_t) next_gen()->gc_stats()->avg_promoted()->last_sample();
546 assert(promoted < gch->capacity(), "Conversion problem?");
547 size_t survived_guess = survived + promoted;
548 size_policy->avg_survived()->sample(survived_guess);
549 }
550
551 size_t survivor_limit = max_survivor_size();
552 _tenuring_threshold =
553 size_policy->compute_survivor_space_size_and_threshold(
554 _survivor_overflow,
555 _tenuring_threshold,
556 survivor_limit);
557 size_policy->avg_young_live()->sample(used());
558 size_policy->avg_eden_live()->sample(eden()->used());
559
560 size_policy->compute_young_generation_free_space(eden()->capacity(),
561 max_gen_size());
562
563 resize(size_policy->calculated_eden_size_in_bytes(),
564 size_policy->calculated_survivor_size_in_bytes());
565
566 if (UsePerfData) {
567 CMSGCAdaptivePolicyCounters* counters =
568 (CMSGCAdaptivePolicyCounters*) gch->collector_policy()->counters();
569 assert(counters->kind() ==
570 GCPolicyCounters::CMSGCAdaptivePolicyCountersKind,
571 "Wrong kind of counters");
572 counters->update_tenuring_threshold(_tenuring_threshold);
573 counters->update_survivor_overflowed(_survivor_overflow);
574 counters->update_young_capacity(capacity());
575 }
576 }
577
578
579 #ifndef PRODUCT
580 // Changes from PSYoungGen version
581 // value of "alignment"
582 void ASParNewGeneration::space_invariants() {
583 const size_t alignment = os::vm_page_size();
584
585 // Currently, our eden size cannot shrink to zero
586 guarantee(eden()->capacity() >= alignment, "eden too small");
587 guarantee(from()->capacity() >= alignment, "from too small");
588 guarantee(to()->capacity() >= alignment, "to too small");
589
590 // Relationship of spaces to each other
591 char* eden_start = (char*)eden()->bottom();
592 char* eden_end = (char*)eden()->end();
593 char* from_start = (char*)from()->bottom();
594 char* from_end = (char*)from()->end();
595 char* to_start = (char*)to()->bottom();
596 char* to_end = (char*)to()->end();
597
598 guarantee(eden_start >= virtual_space()->low(), "eden bottom");
599 guarantee(eden_start < eden_end, "eden space consistency");
600 guarantee(from_start < from_end, "from space consistency");
601 guarantee(to_start < to_end, "to space consistency");
602
603 // Check whether from space is below to space
604 if (from_start < to_start) {
605 // Eden, from, to
606 guarantee(eden_end <= from_start, "eden/from boundary");
607 guarantee(from_end <= to_start, "from/to boundary");
608 guarantee(to_end <= virtual_space()->high(), "to end");
609 } else {
610 // Eden, to, from
611 guarantee(eden_end <= to_start, "eden/to boundary");
612 guarantee(to_end <= from_start, "to/from boundary");
613 guarantee(from_end <= virtual_space()->high(), "from end");
614 }
615
616 // More checks that the virtual space is consistent with the spaces
617 assert(virtual_space()->committed_size() >=
618 (eden()->capacity() +
619 to()->capacity() +
620 from()->capacity()), "Committed size is inconsistent");
621 assert(virtual_space()->committed_size() <= virtual_space()->reserved_size(),
622 "Space invariant");
623 char* eden_top = (char*)eden()->top();
624 char* from_top = (char*)from()->top();
625 char* to_top = (char*)to()->top();
626 assert(eden_top <= virtual_space()->high(), "eden top");
627 assert(from_top <= virtual_space()->high(), "from top");
628 assert(to_top <= virtual_space()->high(), "to top");
629 }
630 #endif