1 /*
2 * Copyright (c) 2002, 2015, 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 "classfile/stringTable.hpp"
27 #include "code/codeCache.hpp"
28 #include "gc/parallel/cardTableExtension.hpp"
29 #include "gc/parallel/gcTaskManager.hpp"
30 #include "gc/parallel/parallelScavengeHeap.hpp"
31 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
32 #include "gc/parallel/psMarkSweep.hpp"
33 #include "gc/parallel/psParallelCompact.hpp"
34 #include "gc/parallel/psScavenge.inline.hpp"
35 #include "gc/parallel/psTasks.hpp"
36 #include "gc/shared/collectorPolicy.hpp"
37 #include "gc/shared/gcCause.hpp"
38 #include "gc/shared/gcHeapSummary.hpp"
39 #include "gc/shared/gcId.hpp"
40 #include "gc/shared/gcLocker.inline.hpp"
41 #include "gc/shared/gcTimer.hpp"
42 #include "gc/shared/gcTrace.hpp"
43 #include "gc/shared/gcTraceTime.inline.hpp"
44 #include "gc/shared/isGCActiveMark.hpp"
45 #include "gc/shared/referencePolicy.hpp"
46 #include "gc/shared/referenceProcessor.hpp"
47 #include "gc/shared/spaceDecorator.hpp"
48 #include "memory/resourceArea.hpp"
49 #include "logging/log.hpp"
50 #include "oops/oop.inline.hpp"
51 #include "runtime/biasedLocking.hpp"
52 #include "runtime/fprofiler.hpp"
53 #include "runtime/handles.inline.hpp"
744 if (young_gen->used_in_bytes() < (size_t) policy->padded_average_promoted_in_bytes()) {
745 log_trace(ergo)(" padded_promoted_average is greater than maximum promotion = " SIZE_FORMAT, young_gen->used_in_bytes());
746 }
747
748 if (result) {
749 _consecutive_skipped_scavenges = 0;
750 } else {
751 _consecutive_skipped_scavenges++;
752 if (UsePerfData) {
753 counters->update_scavenge_skipped(promoted_too_large);
754 }
755 }
756 return result;
757 }
758
759 // Used to add tasks
760 GCTaskManager* const PSScavenge::gc_task_manager() {
761 assert(ParallelScavengeHeap::gc_task_manager() != NULL,
762 "shouldn't return NULL");
763 return ParallelScavengeHeap::gc_task_manager();
764 }
765
766 void PSScavenge::initialize() {
767 // Arguments must have been parsed
768
769 if (AlwaysTenure || NeverTenure) {
770 assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
771 "MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is %d", (int) MaxTenuringThreshold);
772 _tenuring_threshold = MaxTenuringThreshold;
773 } else {
774 // We want to smooth out our startup times for the AdaptiveSizePolicy
775 _tenuring_threshold = (UseAdaptiveSizePolicy) ? InitialTenuringThreshold :
776 MaxTenuringThreshold;
777 }
778
779 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
780 PSYoungGen* young_gen = heap->young_gen();
781 PSOldGen* old_gen = heap->old_gen();
782
783 // Set boundary between young_gen and old_gen
|
1 /*
2 * Copyright (c) 2002, 2016, 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 "classfile/stringTable.hpp"
27 #include "code/codeCache.hpp"
28 #include "gc/parallel/cardTableExtension.hpp"
29 #include "gc/parallel/gcTaskManager.hpp"
30 #include "gc/parallel/parallelScavengeHeap.hpp"
31 #include "gc/parallel/psAdaptiveSizePolicy.hpp"
32 #include "gc/parallel/psMarkSweep.hpp"
33 #include "gc/parallel/psParallelCompact.inline.hpp"
34 #include "gc/parallel/psScavenge.inline.hpp"
35 #include "gc/parallel/psTasks.hpp"
36 #include "gc/shared/collectorPolicy.hpp"
37 #include "gc/shared/gcCause.hpp"
38 #include "gc/shared/gcHeapSummary.hpp"
39 #include "gc/shared/gcId.hpp"
40 #include "gc/shared/gcLocker.inline.hpp"
41 #include "gc/shared/gcTimer.hpp"
42 #include "gc/shared/gcTrace.hpp"
43 #include "gc/shared/gcTraceTime.inline.hpp"
44 #include "gc/shared/isGCActiveMark.hpp"
45 #include "gc/shared/referencePolicy.hpp"
46 #include "gc/shared/referenceProcessor.hpp"
47 #include "gc/shared/spaceDecorator.hpp"
48 #include "memory/resourceArea.hpp"
49 #include "logging/log.hpp"
50 #include "oops/oop.inline.hpp"
51 #include "runtime/biasedLocking.hpp"
52 #include "runtime/fprofiler.hpp"
53 #include "runtime/handles.inline.hpp"
744 if (young_gen->used_in_bytes() < (size_t) policy->padded_average_promoted_in_bytes()) {
745 log_trace(ergo)(" padded_promoted_average is greater than maximum promotion = " SIZE_FORMAT, young_gen->used_in_bytes());
746 }
747
748 if (result) {
749 _consecutive_skipped_scavenges = 0;
750 } else {
751 _consecutive_skipped_scavenges++;
752 if (UsePerfData) {
753 counters->update_scavenge_skipped(promoted_too_large);
754 }
755 }
756 return result;
757 }
758
759 // Used to add tasks
760 GCTaskManager* const PSScavenge::gc_task_manager() {
761 assert(ParallelScavengeHeap::gc_task_manager() != NULL,
762 "shouldn't return NULL");
763 return ParallelScavengeHeap::gc_task_manager();
764 }
765
766 // Adaptive size policy support. When the young generation/old generation
767 // boundary moves, _young_generation_boundary must be reset
768 void PSScavenge::set_young_generation_boundary(HeapWord* v) {
769 _young_generation_boundary = v;
770 if (UseCompressedOops) {
771 _young_generation_boundary_compressed = (uintptr_t)oopDesc::encode_heap_oop((oop)v);
772 }
773 }
774
775 void PSScavenge::initialize() {
776 // Arguments must have been parsed
777
778 if (AlwaysTenure || NeverTenure) {
779 assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
780 "MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is %d", (int) MaxTenuringThreshold);
781 _tenuring_threshold = MaxTenuringThreshold;
782 } else {
783 // We want to smooth out our startup times for the AdaptiveSizePolicy
784 _tenuring_threshold = (UseAdaptiveSizePolicy) ? InitialTenuringThreshold :
785 MaxTenuringThreshold;
786 }
787
788 ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
789 PSYoungGen* young_gen = heap->young_gen();
790 PSOldGen* old_gen = heap->old_gen();
791
792 // Set boundary between young_gen and old_gen
|