comparison src/os_cpu/solaris_x86/vm/copy_solaris_x86.inline.hpp @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children c18cbe5936b8
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 /*
2 * Copyright 2003-2004 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
26 (void)memmove(to, from, count * HeapWordSize);
27 }
28
29 static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
30 #ifndef AMD64
31 (void)memcpy(to, from, count * HeapWordSize);
32 #else
33 switch (count) {
34 case 8: to[7] = from[7];
35 case 7: to[6] = from[6];
36 case 6: to[5] = from[5];
37 case 5: to[4] = from[4];
38 case 4: to[3] = from[3];
39 case 3: to[2] = from[2];
40 case 2: to[1] = from[1];
41 case 1: to[0] = from[0];
42 case 0: break;
43 default:
44 (void)memcpy(to, from, count * HeapWordSize);
45 break;
46 }
47 #endif // AMD64
48 }
49
50 static void pd_disjoint_words_atomic(HeapWord* from, HeapWord* to, size_t count) {
51 switch (count) {
52 case 8: to[7] = from[7];
53 case 7: to[6] = from[6];
54 case 6: to[5] = from[5];
55 case 5: to[4] = from[4];
56 case 4: to[3] = from[3];
57 case 3: to[2] = from[2];
58 case 2: to[1] = from[1];
59 case 1: to[0] = from[0];
60 case 0: break;
61 default: while (count-- > 0) {
62 *to++ = *from++;
63 }
64 break;
65 }
66 }
67
68 static void pd_aligned_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
69 (void)memmove(to, from, count * HeapWordSize);
70 }
71
72 static void pd_aligned_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
73 pd_disjoint_words(from, to, count);
74 }
75
76 static void pd_conjoint_bytes(void* from, void* to, size_t count) {
77 #ifdef AMD64
78 (void)memmove(to, from, count);
79 #else
80 _Copy_conjoint_bytes(from, to, count);
81 #endif // AMD64
82 }
83
84 static void pd_conjoint_bytes_atomic(void* from, void* to, size_t count) {
85 pd_conjoint_bytes(from, to, count);
86 }
87
88 static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
89 _Copy_conjoint_jshorts_atomic(from, to, count);
90 }
91
92 static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
93 _Copy_conjoint_jints_atomic(from, to, count);
94 }
95
96 static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
97 // Guarantee use of fild/fistp or xmm regs via some asm code, because compilers won't.
98 _Copy_conjoint_jlongs_atomic(from, to, count);
99 }
100
101 static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) {
102 #ifdef AMD64
103 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
104 _Copy_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
105 #else
106 _Copy_conjoint_jints_atomic((jint*)from, (jint*)to, count);
107 #endif // AMD64
108 }
109
110 static void pd_arrayof_conjoint_bytes(HeapWord* from, HeapWord* to, size_t count) {
111 _Copy_arrayof_conjoint_bytes(from, to, count);
112 }
113
114 static void pd_arrayof_conjoint_jshorts(HeapWord* from, HeapWord* to, size_t count) {
115 _Copy_arrayof_conjoint_jshorts(from, to, count);
116 }
117
118 static void pd_arrayof_conjoint_jints(HeapWord* from, HeapWord* to, size_t count) {
119 _Copy_arrayof_conjoint_jints(from, to, count);
120 }
121
122 static void pd_arrayof_conjoint_jlongs(HeapWord* from, HeapWord* to, size_t count) {
123 #ifdef AMD64
124 _Copy_arrayof_conjoint_jlongs(from, to, count);
125 #else
126 pd_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
127 #endif // AMD64
128 }
129
130 static void pd_arrayof_conjoint_oops(HeapWord* from, HeapWord* to, size_t count) {
131 #ifdef AMD64
132 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
133 _Copy_arrayof_conjoint_jlongs(from, to, count);
134 #else
135 assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size");
136 _Copy_arrayof_conjoint_jints(from, to, count);
137 #endif // AMD64
138 }