annotate src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp @ 989:148e5441d916

6863023: need non-perm oops in code cache for JSR 292 Summary: Make a special root-list for those few nmethods which might contain non-perm oops. Reviewed-by: twisti, kvn, never, jmasa, ysr
author jrose
date Tue, 15 Sep 2009 21:53:47 -0700
parents a61af66fc99e
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 # include "incls/_precompiled.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
26 # include "incls/_cmsCollectorPolicy.cpp.incl"
a61af66fc99e Initial load
duke
parents:
diff changeset
27
a61af66fc99e Initial load
duke
parents:
diff changeset
28 //
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // ConcurrentMarkSweepPolicy methods
a61af66fc99e Initial load
duke
parents:
diff changeset
30 //
a61af66fc99e Initial load
duke
parents:
diff changeset
31
a61af66fc99e Initial load
duke
parents:
diff changeset
32 ConcurrentMarkSweepPolicy::ConcurrentMarkSweepPolicy() {
a61af66fc99e Initial load
duke
parents:
diff changeset
33 initialize_all();
a61af66fc99e Initial load
duke
parents:
diff changeset
34 }
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 void ConcurrentMarkSweepPolicy::initialize_generations() {
a61af66fc99e Initial load
duke
parents:
diff changeset
37 initialize_perm_generation(PermGen::ConcurrentMarkSweep);
a61af66fc99e Initial load
duke
parents:
diff changeset
38 _generations = new GenerationSpecPtr[number_of_generations()];
a61af66fc99e Initial load
duke
parents:
diff changeset
39 if (_generations == NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
40 vm_exit_during_initialization("Unable to allocate gen spec");
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 if (UseParNewGC && ParallelGCThreads > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
43 if (UseAdaptiveSizePolicy) {
a61af66fc99e Initial load
duke
parents:
diff changeset
44 _generations[0] = new GenerationSpec(Generation::ASParNew,
a61af66fc99e Initial load
duke
parents:
diff changeset
45 _initial_gen0_size, _max_gen0_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
46 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
47 _generations[0] = new GenerationSpec(Generation::ParNew,
a61af66fc99e Initial load
duke
parents:
diff changeset
48 _initial_gen0_size, _max_gen0_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
49 }
a61af66fc99e Initial load
duke
parents:
diff changeset
50 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 _generations[0] = new GenerationSpec(Generation::DefNew,
a61af66fc99e Initial load
duke
parents:
diff changeset
52 _initial_gen0_size, _max_gen0_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
53 }
a61af66fc99e Initial load
duke
parents:
diff changeset
54 if (UseAdaptiveSizePolicy) {
a61af66fc99e Initial load
duke
parents:
diff changeset
55 _generations[1] = new GenerationSpec(Generation::ASConcurrentMarkSweep,
a61af66fc99e Initial load
duke
parents:
diff changeset
56 _initial_gen1_size, _max_gen1_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
57 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
58 _generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep,
a61af66fc99e Initial load
duke
parents:
diff changeset
59 _initial_gen1_size, _max_gen1_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
60 }
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 if (_generations[0] == NULL || _generations[1] == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 vm_exit_during_initialization("Unable to allocate gen spec");
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 }
a61af66fc99e Initial load
duke
parents:
diff changeset
66
a61af66fc99e Initial load
duke
parents:
diff changeset
67 void ConcurrentMarkSweepPolicy::initialize_size_policy(size_t init_eden_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
68 size_t init_promo_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
69 size_t init_survivor_size) {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 double max_gc_minor_pause_sec = ((double) MaxGCMinorPauseMillis)/1000.0;
a61af66fc99e Initial load
duke
parents:
diff changeset
71 double max_gc_pause_sec = ((double) MaxGCPauseMillis)/1000.0;
a61af66fc99e Initial load
duke
parents:
diff changeset
72 _size_policy = new CMSAdaptiveSizePolicy(init_eden_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
73 init_promo_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
74 init_survivor_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
75 max_gc_minor_pause_sec,
a61af66fc99e Initial load
duke
parents:
diff changeset
76 max_gc_pause_sec,
a61af66fc99e Initial load
duke
parents:
diff changeset
77 GCTimeRatio);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 void ConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // initialize the policy counters - 2 collectors, 3 generations
a61af66fc99e Initial load
duke
parents:
diff changeset
82 if (UseParNewGC && ParallelGCThreads > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 _gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
a61af66fc99e Initial load
duke
parents:
diff changeset
84 }
a61af66fc99e Initial load
duke
parents:
diff changeset
85 else {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 _gc_policy_counters = new GCPolicyCounters("Copy:CMS", 2, 3);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 }
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 // Returns true if the incremental mode is enabled.
a61af66fc99e Initial load
duke
parents:
diff changeset
91 bool ConcurrentMarkSweepPolicy::has_soft_ended_eden()
a61af66fc99e Initial load
duke
parents:
diff changeset
92 {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 return CMSIncrementalMode;
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 //
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // ASConcurrentMarkSweepPolicy methods
a61af66fc99e Initial load
duke
parents:
diff changeset
99 //
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 void ASConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 assert(size_policy() != NULL, "A size policy is required");
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // initialize the policy counters - 2 collectors, 3 generations
a61af66fc99e Initial load
duke
parents:
diff changeset
105 if (UseParNewGC && ParallelGCThreads > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 _gc_policy_counters = new CMSGCAdaptivePolicyCounters("ParNew:CMS", 2, 3,
a61af66fc99e Initial load
duke
parents:
diff changeset
107 size_policy());
a61af66fc99e Initial load
duke
parents:
diff changeset
108 }
a61af66fc99e Initial load
duke
parents:
diff changeset
109 else {
a61af66fc99e Initial load
duke
parents:
diff changeset
110 _gc_policy_counters = new CMSGCAdaptivePolicyCounters("Copy:CMS", 2, 3,
a61af66fc99e Initial load
duke
parents:
diff changeset
111 size_policy());
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }