annotate src/os_cpu/solaris_x86/vm/copy_solaris_x86.inline.hpp @ 1250:3f5b7efb9642

6920293: OptimizeStringConcat causing core dumps Reviewed-by: kvn, twisti
author never
date Fri, 05 Feb 2010 11:07:40 -0800
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 2003-2004 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 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
26 (void)memmove(to, from, count * HeapWordSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
27 }
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
30 #ifndef AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
31 (void)memcpy(to, from, count * HeapWordSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
32 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
33 switch (count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
34 case 8: to[7] = from[7];
a61af66fc99e Initial load
duke
parents:
diff changeset
35 case 7: to[6] = from[6];
a61af66fc99e Initial load
duke
parents:
diff changeset
36 case 6: to[5] = from[5];
a61af66fc99e Initial load
duke
parents:
diff changeset
37 case 5: to[4] = from[4];
a61af66fc99e Initial load
duke
parents:
diff changeset
38 case 4: to[3] = from[3];
a61af66fc99e Initial load
duke
parents:
diff changeset
39 case 3: to[2] = from[2];
a61af66fc99e Initial load
duke
parents:
diff changeset
40 case 2: to[1] = from[1];
a61af66fc99e Initial load
duke
parents:
diff changeset
41 case 1: to[0] = from[0];
a61af66fc99e Initial load
duke
parents:
diff changeset
42 case 0: break;
a61af66fc99e Initial load
duke
parents:
diff changeset
43 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
44 (void)memcpy(to, from, count * HeapWordSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
45 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 }
a61af66fc99e Initial load
duke
parents:
diff changeset
47 #endif // AMD64
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 #ifdef AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
78 (void)memmove(to, from, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
79 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
80 _Copy_conjoint_bytes(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 #endif // AMD64
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_bytes_atomic(void* from, void* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 pd_conjoint_bytes(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
86 }
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
89 _Copy_conjoint_jshorts_atomic(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 }
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 _Copy_conjoint_jints_atomic(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // Guarantee use of fild/fistp or xmm regs via some asm code, because compilers won't.
a61af66fc99e Initial load
duke
parents:
diff changeset
98 _Copy_conjoint_jlongs_atomic(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
99 }
a61af66fc99e Initial load
duke
parents:
diff changeset
100
a61af66fc99e Initial load
duke
parents:
diff changeset
101 static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 #ifdef AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
103 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
a61af66fc99e Initial load
duke
parents:
diff changeset
104 _Copy_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
105 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
106 _Copy_conjoint_jints_atomic((jint*)from, (jint*)to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
107 #endif // AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
108 }
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 static void pd_arrayof_conjoint_bytes(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 _Copy_arrayof_conjoint_bytes(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 static void pd_arrayof_conjoint_jshorts(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 _Copy_arrayof_conjoint_jshorts(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
116 }
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 static void pd_arrayof_conjoint_jints(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
119 _Copy_arrayof_conjoint_jints(from, to, count);
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_jlongs(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 #ifdef AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
124 _Copy_arrayof_conjoint_jlongs(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
125 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
126 pd_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 #endif // AMD64
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_oops(HeapWord* from, HeapWord* to, size_t count) {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 #ifdef AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
132 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
a61af66fc99e Initial load
duke
parents:
diff changeset
133 _Copy_arrayof_conjoint_jlongs(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
134 #else
a61af66fc99e Initial load
duke
parents:
diff changeset
135 assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size");
a61af66fc99e Initial load
duke
parents:
diff changeset
136 _Copy_arrayof_conjoint_jints(from, to, count);
a61af66fc99e Initial load
duke
parents:
diff changeset
137 #endif // AMD64
a61af66fc99e Initial load
duke
parents:
diff changeset
138 }