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 "aot/aotLoader.hpp"
27 #include "classfile/classLoaderDataGraph.hpp"
28 #include "classfile/stringTable.hpp"
29 #include "classfile/symbolTable.hpp"
30 #include "classfile/systemDictionary.hpp"
31 #include "code/codeCache.hpp"
32 #include "gc/parallel/parallelScavengeHeap.hpp"
33 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
34 #include "gc/parallel/psMarkSweep.hpp"
35 #include "gc/parallel/psMarkSweepDecorator.hpp"
36 #include "gc/parallel/psOldGen.hpp"
37 #include "gc/parallel/psScavenge.hpp"
38 #include "gc/parallel/psYoungGen.hpp"
39 #include "gc/serial/markSweep.hpp"
40 #include "gc/shared/gcCause.hpp"
41 #include "gc/shared/gcHeapSummary.hpp"
42 #include "gc/shared/gcId.hpp"
43 #include "gc/shared/gcLocker.hpp"
44 #include "gc/shared/gcTimer.hpp"
45 #include "gc/shared/gcTrace.hpp"
46 #include "gc/shared/gcTraceTime.inline.hpp"
47 #include "gc/shared/isGCActiveMark.hpp"
48 #include "gc/shared/referencePolicy.hpp"
49 #include "gc/shared/referenceProcessor.hpp"
50 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
51 #include "gc/shared/spaceDecorator.hpp"
52 #include "gc/shared/weakProcessor.hpp"
53 #include "logging/log.hpp"
54 #include "oops/oop.inline.hpp"
55 #include "runtime/biasedLocking.hpp"
56 #include "runtime/flags/flagSetting.hpp"
57 #include "runtime/handles.inline.hpp"
58 #include "runtime/safepoint.hpp"
59 #include "runtime/vmThread.hpp"
432 if (new_young_size < young_gen->min_gen_size()) {
433 return false; // Respect young gen minimum size.
434 }
435
436 log_trace(gc, ergo, heap)(" absorbing " SIZE_FORMAT "K: "
437 "eden " SIZE_FORMAT "K->" SIZE_FORMAT "K "
438 "from " SIZE_FORMAT "K, to " SIZE_FORMAT "K "
439 "young_gen " SIZE_FORMAT "K->" SIZE_FORMAT "K ",
440 absorb_size / K,
441 eden_capacity / K, (eden_capacity - absorb_size) / K,
442 young_gen->from_space()->used_in_bytes() / K,
443 young_gen->to_space()->used_in_bytes() / K,
444 young_gen->capacity_in_bytes() / K, new_young_size / K);
445
446 // Fill the unused part of the old gen.
447 MutableSpace* const old_space = old_gen->object_space();
448 HeapWord* const unused_start = old_space->top();
449 size_t const unused_words = pointer_delta(old_space->end(), unused_start);
450
451 if (unused_words > 0) {
452 if (unused_words < CollectedHeap::min_fill_size()) {
453 return false; // If the old gen cannot be filled, must give up.
454 }
455 CollectedHeap::fill_with_objects(unused_start, unused_words);
456 }
457
458 // Take the live data from eden and set both top and end in the old gen to
459 // eden top. (Need to set end because reset_after_change() mangles the region
460 // from end to virtual_space->high() in debug builds).
461 HeapWord* const new_top = eden_space->top();
462 old_gen->virtual_space()->expand_into(young_gen->virtual_space(),
463 absorb_size);
464 young_gen->reset_after_change();
465 old_space->set_top(new_top);
466 old_space->set_end(new_top);
467 old_gen->reset_after_change();
468
469 // Update the object start array for the filler object and the data from eden.
470 ObjectStartArray* const start_array = old_gen->start_array();
471 for (HeapWord* p = unused_start; p < new_top; p += oop(p)->size()) {
472 start_array->allocate_block(p);
473 }
474
475 // Could update the promoted average here, but it is not typically updated at
|
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 "aot/aotLoader.hpp"
27 #include "classfile/classLoaderDataGraph.hpp"
28 #include "classfile/stringTable.hpp"
29 #include "classfile/symbolTable.hpp"
30 #include "classfile/systemDictionary.hpp"
31 #include "code/codeCache.hpp"
32 #include "gc/parallel/parallelScavengeHeap.hpp"
33 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
34 #include "gc/parallel/psMarkSweep.hpp"
35 #include "gc/parallel/psMarkSweepDecorator.hpp"
36 #include "gc/parallel/psOldGen.hpp"
37 #include "gc/parallel/psScavenge.hpp"
38 #include "gc/parallel/psYoungGen.hpp"
39 #include "gc/serial/markSweep.hpp"
40 #include "gc/shared/fill.hpp"
41 #include "gc/shared/gcCause.hpp"
42 #include "gc/shared/gcHeapSummary.hpp"
43 #include "gc/shared/gcId.hpp"
44 #include "gc/shared/gcLocker.hpp"
45 #include "gc/shared/gcTimer.hpp"
46 #include "gc/shared/gcTrace.hpp"
47 #include "gc/shared/gcTraceTime.inline.hpp"
48 #include "gc/shared/isGCActiveMark.hpp"
49 #include "gc/shared/referencePolicy.hpp"
50 #include "gc/shared/referenceProcessor.hpp"
51 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
52 #include "gc/shared/spaceDecorator.hpp"
53 #include "gc/shared/weakProcessor.hpp"
54 #include "logging/log.hpp"
55 #include "oops/oop.inline.hpp"
56 #include "runtime/biasedLocking.hpp"
57 #include "runtime/flags/flagSetting.hpp"
58 #include "runtime/handles.inline.hpp"
59 #include "runtime/safepoint.hpp"
60 #include "runtime/vmThread.hpp"
433 if (new_young_size < young_gen->min_gen_size()) {
434 return false; // Respect young gen minimum size.
435 }
436
437 log_trace(gc, ergo, heap)(" absorbing " SIZE_FORMAT "K: "
438 "eden " SIZE_FORMAT "K->" SIZE_FORMAT "K "
439 "from " SIZE_FORMAT "K, to " SIZE_FORMAT "K "
440 "young_gen " SIZE_FORMAT "K->" SIZE_FORMAT "K ",
441 absorb_size / K,
442 eden_capacity / K, (eden_capacity - absorb_size) / K,
443 young_gen->from_space()->used_in_bytes() / K,
444 young_gen->to_space()->used_in_bytes() / K,
445 young_gen->capacity_in_bytes() / K, new_young_size / K);
446
447 // Fill the unused part of the old gen.
448 MutableSpace* const old_space = old_gen->object_space();
449 HeapWord* const unused_start = old_space->top();
450 size_t const unused_words = pointer_delta(old_space->end(), unused_start);
451
452 if (unused_words > 0) {
453 if (unused_words < Fill::min_size()) {
454 return false; // If the old gen cannot be filled, must give up.
455 }
456 Fill::range(unused_start, unused_words);
457 }
458
459 // Take the live data from eden and set both top and end in the old gen to
460 // eden top. (Need to set end because reset_after_change() mangles the region
461 // from end to virtual_space->high() in debug builds).
462 HeapWord* const new_top = eden_space->top();
463 old_gen->virtual_space()->expand_into(young_gen->virtual_space(),
464 absorb_size);
465 young_gen->reset_after_change();
466 old_space->set_top(new_top);
467 old_space->set_end(new_top);
468 old_gen->reset_after_change();
469
470 // Update the object start array for the filler object and the data from eden.
471 ObjectStartArray* const start_array = old_gen->start_array();
472 for (HeapWord* p = unused_start; p < new_top; p += oop(p)->size()) {
473 start_array->allocate_block(p);
474 }
475
476 // Could update the promoted average here, but it is not typically updated at
|