annotate src/cpu/sparc/vm/copy_sparc.hpp @ 2368:dde920245681

6896099: Integrate CMS heap ergo with default heap sizing ergo 6627787: CMS: JVM refuses to start up with -Xms16m -Xmx16m 7000125: CMS: Anti-monotone young gen sizing with respect to maximum whole heap size specification 7027529: CMS: retire CMSUseOldDefaults flag Summary: Simplify CMS heap sizing code, relying on ergonomic initial sizing consistent with other collectors for the most part, controlling only young gen sizing to rein in pause times. Make CMS young gen sizing default statically cpu-dependant. Remove inconsistencies wrt generation sizing and policy code, allowing for the fixing for 6627787 and 7000125. For 7027529, retire the flag CMSUseOldDefaults which had been introduced as a bridge from JDK 5 to JDK 6 a number of years ago. Reviewed-by: brutisso, poonam
author ysr
date Wed, 16 Mar 2011 10:37:08 -0700
parents f95d63e2154a
children baf763f388e6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1579
diff changeset
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
0
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 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1579
diff changeset
25 #ifndef CPU_SPARC_VM_COPY_SPARC_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1579
diff changeset
26 #define CPU_SPARC_VM_COPY_SPARC_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1579
diff changeset
27
0
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // Inline functions for memory copy and fill.
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
31 (void)memmove(to, from, count * HeapWordSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
32 }
a61af66fc99e Initial load
duke
parents:
diff changeset
33
a61af66fc99e Initial load
duke
parents:
diff changeset
34 static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
35 switch (count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
36 case 8: to[7] = from[7];
a61af66fc99e Initial load
duke
parents:
diff changeset
37 case 7: to[6] = from[6];
a61af66fc99e Initial load
duke
parents:
diff changeset
38 case 6: to[5] = from[5];
a61af66fc99e Initial load
duke
parents:
diff changeset
39 case 5: to[4] = from[4];
a61af66fc99e Initial load
duke
parents:
diff changeset
40 case 4: to[3] = from[3];
a61af66fc99e Initial load
duke
parents:
diff changeset
41 case 3: to[2] = from[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
42 case 2: to[1] = from[1];
a61af66fc99e Initial load
duke
parents:
diff changeset
43 case 1: to[0] = from[0];
a61af66fc99e Initial load
duke
parents:
diff changeset
44 case 0: break;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 default: (void)memcpy(to, from, count * HeapWordSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
46 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
47 }
a61af66fc99e Initial load
duke
parents:
diff changeset
48 }
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 static void pd_disjoint_words_atomic(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 switch (count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
52 case 8: to[7] = from[7];
a61af66fc99e Initial load
duke
parents:
diff changeset
53 case 7: to[6] = from[6];
a61af66fc99e Initial load
duke
parents:
diff changeset
54 case 6: to[5] = from[5];
a61af66fc99e Initial load
duke
parents:
diff changeset
55 case 5: to[4] = from[4];
a61af66fc99e Initial load
duke
parents:
diff changeset
56 case 4: to[3] = from[3];
a61af66fc99e Initial load
duke
parents:
diff changeset
57 case 3: to[2] = from[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
58 case 2: to[1] = from[1];
a61af66fc99e Initial load
duke
parents:
diff changeset
59 case 1: to[0] = from[0];
a61af66fc99e Initial load
duke
parents:
diff changeset
60 case 0: break;
a61af66fc99e Initial load
duke
parents:
diff changeset
61 default: while (count-- > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
62 *to++ = *from++;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 }
a61af66fc99e Initial load
duke
parents:
diff changeset
64 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
65 }
a61af66fc99e Initial load
duke
parents:
diff changeset
66 }
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 static void pd_aligned_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
69 (void)memmove(to, from, count * HeapWordSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
70 }
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 static void pd_aligned_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
73 pd_disjoint_words(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
74 }
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 static void pd_conjoint_bytes(void* from, void* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 (void)memmove(to, from, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 static void pd_conjoint_bytes_atomic(void* from, void* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
81 (void)memmove(to, from, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // FIXME
a61af66fc99e Initial load
duke
parents:
diff changeset
86 (void)memmove(to, from, count << LogBytesPerShort);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 }
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
90 // FIXME
a61af66fc99e Initial load
duke
parents:
diff changeset
91 (void)memmove(to, from, count << LogBytesPerInt);
a61af66fc99e Initial load
duke
parents:
diff changeset
92 }
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
95 #ifdef _LP64
a61af66fc99e Initial load
duke
parents:
diff changeset
96 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
a61af66fc99e Initial load
duke
parents:
diff changeset
97 pd_conjoint_oops_atomic((oop*)from, (oop*)to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
98 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Guarantee use of ldd/std via some asm code, because compiler won't.
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // See solaris_sparc.il.
a61af66fc99e Initial load
duke
parents:
diff changeset
101 _Copy_conjoint_jlongs_atomic(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
102 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // Do better than this: inline memmove body NEEDS CLEANUP
a61af66fc99e Initial load
duke
parents:
diff changeset
107 if (from > to) {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 while (count-- > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // Copy forwards
a61af66fc99e Initial load
duke
parents:
diff changeset
110 *to++ = *from++;
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
113 from += count - 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
114 to += count - 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
115 while (count-- > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
116 // Copy backwards
a61af66fc99e Initial load
duke
parents:
diff changeset
117 *to-- = *from--;
a61af66fc99e Initial load
duke
parents:
diff changeset
118 }
a61af66fc99e Initial load
duke
parents:
diff changeset
119 }
a61af66fc99e Initial load
duke
parents:
diff changeset
120 }
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 static void pd_arrayof_conjoint_bytes(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 pd_conjoint_bytes_atomic(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 static void pd_arrayof_conjoint_jshorts(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
127 pd_conjoint_jshorts_atomic((jshort*)from, (jshort*)to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
128 }
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 static void pd_arrayof_conjoint_jints(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 pd_conjoint_jints_atomic((jint*)from, (jint*)to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
132 }
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 static void pd_arrayof_conjoint_jlongs(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 pd_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
136 }
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 static void pd_arrayof_conjoint_oops(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
139 pd_conjoint_oops_atomic((oop*)from, (oop*)to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142 static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
143 #ifdef _LP64
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
144 guarantee(mask_bits((uintptr_t)tohw, right_n_bits(LogBytesPerLong)) == 0,
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
145 "unaligned fill words");
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
146 julong* to = (julong*)tohw;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
147 julong v = ((julong)value << 32) | value;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
148 while (count-- > 0) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
149 *to++ = v;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
150 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
151 #else // _LP64
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
152 juint* to = (juint*)tohw;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
153 while (count-- > 0) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
154 *to++ = value;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
155 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
156 #endif // _LP64
0
a61af66fc99e Initial load
duke
parents:
diff changeset
157 }
a61af66fc99e Initial load
duke
parents:
diff changeset
158
a61af66fc99e Initial load
duke
parents:
diff changeset
159 static void pd_fill_to_aligned_words(HeapWord* tohw, size_t count, juint value) {
1571
2d127394260e 6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents: 196
diff changeset
160 assert(MinObjAlignmentInBytes >= BytesPerLong, "need alternate implementation");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162 julong* to = (julong*)tohw;
a61af66fc99e Initial load
duke
parents:
diff changeset
163 julong v = ((julong)value << 32) | value;
a61af66fc99e Initial load
duke
parents:
diff changeset
164 // If count is odd, odd will be equal to 1 on 32-bit platform
a61af66fc99e Initial load
duke
parents:
diff changeset
165 // and be equal to 0 on 64-bit platform.
a61af66fc99e Initial load
duke
parents:
diff changeset
166 size_t odd = count % (BytesPerLong / HeapWordSize) ;
a61af66fc99e Initial load
duke
parents:
diff changeset
167
1571
2d127394260e 6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents: 196
diff changeset
168 size_t aligned_count = align_object_offset(count - odd) / HeapWordsPerLong;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
169 julong* end = ((julong*)tohw) + aligned_count - 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
170 while (to <= end) {
a61af66fc99e Initial load
duke
parents:
diff changeset
171 DEBUG_ONLY(count -= BytesPerLong / HeapWordSize ;)
a61af66fc99e Initial load
duke
parents:
diff changeset
172 *to++ = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
173 }
a61af66fc99e Initial load
duke
parents:
diff changeset
174 assert(count == odd, "bad bounds on loop filling to aligned words");
a61af66fc99e Initial load
duke
parents:
diff changeset
175 if (odd) {
a61af66fc99e Initial load
duke
parents:
diff changeset
176 *((juint*)to) = value;
a61af66fc99e Initial load
duke
parents:
diff changeset
177
a61af66fc99e Initial load
duke
parents:
diff changeset
178 }
a61af66fc99e Initial load
duke
parents:
diff changeset
179 }
a61af66fc99e Initial load
duke
parents:
diff changeset
180
a61af66fc99e Initial load
duke
parents:
diff changeset
181 static void pd_fill_to_bytes(void* to, size_t count, jubyte value) {
a61af66fc99e Initial load
duke
parents:
diff changeset
182 (void)memset(to, value, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
183 }
a61af66fc99e Initial load
duke
parents:
diff changeset
184
a61af66fc99e Initial load
duke
parents:
diff changeset
185 static void pd_zero_to_words(HeapWord* tohw, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
186 pd_fill_to_words(tohw, count, 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
187 }
a61af66fc99e Initial load
duke
parents:
diff changeset
188
a61af66fc99e Initial load
duke
parents:
diff changeset
189 static void pd_zero_to_bytes(void* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
190 (void)memset(to, 0, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
191 }
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1579
diff changeset
192
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1579
diff changeset
193 #endif // CPU_SPARC_VM_COPY_SPARC_HPP