Mercurial > hg > truffle
annotate src/cpu/zero/vm/copy_zero.hpp @ 1669:cc3fdfeb54b0 hs19-b05
Merge
author | trims |
---|---|
date | Thu, 29 Jul 2010 23:14:56 -0700 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
rev | line source |
---|---|
1010 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1010
diff
changeset
|
2 * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. |
1010 | 3 * Copyright 2007 Red Hat, Inc. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
5 * | |
6 * This code is free software; you can redistribute it and/or modify it | |
7 * under the terms of the GNU General Public License version 2 only, as | |
8 * published by the Free Software Foundation. | |
9 * | |
10 * This code is distributed in the hope that it will be useful, but WITHOUT | |
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 * version 2 for more details (a copy is included in the LICENSE file that | |
14 * accompanied this code). | |
15 * | |
16 * You should have received a copy of the GNU General Public License version | |
17 * 2 along with this work; if not, write to the Free Software Foundation, | |
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
19 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1010
diff
changeset
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1010
diff
changeset
|
21 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1010
diff
changeset
|
22 * questions. |
1010 | 23 * |
24 */ | |
25 | |
26 // Inline functions for memory copy and fill. | |
27 | |
28 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) { | |
29 memmove(to, from, count * HeapWordSize); | |
30 } | |
31 | |
32 static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) { | |
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 memcpy(to, from, count * HeapWordSize); | |
45 break; | |
46 } | |
47 } | |
48 | |
49 static void pd_disjoint_words_atomic(HeapWord* from, | |
50 HeapWord* to, | |
51 size_t count) { | |
52 switch (count) { | |
53 case 8: to[7] = from[7]; | |
54 case 7: to[6] = from[6]; | |
55 case 6: to[5] = from[5]; | |
56 case 5: to[4] = from[4]; | |
57 case 4: to[3] = from[3]; | |
58 case 3: to[2] = from[2]; | |
59 case 2: to[1] = from[1]; | |
60 case 1: to[0] = from[0]; | |
61 case 0: break; | |
62 default: | |
63 while (count-- > 0) { | |
64 *to++ = *from++; | |
65 } | |
66 break; | |
67 } | |
68 } | |
69 | |
70 static void pd_aligned_conjoint_words(HeapWord* from, | |
71 HeapWord* to, | |
72 size_t count) { | |
73 memmove(to, from, count * HeapWordSize); | |
74 } | |
75 | |
76 static void pd_aligned_disjoint_words(HeapWord* from, | |
77 HeapWord* to, | |
78 size_t count) { | |
79 pd_disjoint_words(from, to, count); | |
80 } | |
81 | |
82 static void pd_conjoint_bytes(void* from, void* to, size_t count) { | |
83 memmove(to, from, count); | |
84 } | |
85 | |
86 static void pd_conjoint_bytes_atomic(void* from, void* to, size_t count) { | |
87 memmove(to, from, count); | |
88 } | |
89 | |
90 static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { | |
91 _Copy_conjoint_jshorts_atomic(from, to, count); | |
92 } | |
93 | |
94 static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) { | |
95 _Copy_conjoint_jints_atomic(from, to, count); | |
96 } | |
97 | |
98 static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { | |
99 _Copy_conjoint_jlongs_atomic(from, to, count); | |
100 } | |
101 | |
102 static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) { | |
103 #ifdef _LP64 | |
104 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); | |
105 _Copy_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count); | |
106 #else | |
107 assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size"); | |
108 _Copy_conjoint_jints_atomic((jint*)from, (jint*)to, count); | |
109 #endif // _LP64 | |
110 } | |
111 | |
112 static void pd_arrayof_conjoint_bytes(HeapWord* from, | |
113 HeapWord* to, | |
114 size_t count) { | |
115 _Copy_arrayof_conjoint_bytes(from, to, count); | |
116 } | |
117 | |
118 static void pd_arrayof_conjoint_jshorts(HeapWord* from, | |
119 HeapWord* to, | |
120 size_t count) { | |
121 _Copy_arrayof_conjoint_jshorts(from, to, count); | |
122 } | |
123 | |
124 static void pd_arrayof_conjoint_jints(HeapWord* from, | |
125 HeapWord* to, | |
126 size_t count) { | |
127 _Copy_arrayof_conjoint_jints(from, to, count); | |
128 } | |
129 | |
130 static void pd_arrayof_conjoint_jlongs(HeapWord* from, | |
131 HeapWord* to, | |
132 size_t count) { | |
133 _Copy_arrayof_conjoint_jlongs(from, to, count); | |
134 } | |
135 | |
136 static void pd_arrayof_conjoint_oops(HeapWord* from, | |
137 HeapWord* to, | |
138 size_t count) { | |
139 #ifdef _LP64 | |
140 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); | |
141 _Copy_arrayof_conjoint_jlongs(from, to, count); | |
142 #else | |
143 assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size"); | |
144 _Copy_arrayof_conjoint_jints(from, to, count); | |
145 #endif // _LP64 | |
146 } | |
147 | |
148 static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) { | |
149 #ifdef _LP64 | |
150 julong* to = (julong*) tohw; | |
151 julong v = ((julong) value << 32) | value; | |
152 #else | |
153 juint* to = (juint*) tohw; | |
154 juint v = value; | |
155 #endif // _LP64 | |
156 | |
157 while (count-- > 0) { | |
158 *to++ = v; | |
159 } | |
160 } | |
161 | |
162 static void pd_fill_to_aligned_words(HeapWord* tohw, | |
163 size_t count, | |
164 juint value) { | |
165 pd_fill_to_words(tohw, count, value); | |
166 } | |
167 | |
168 static void pd_fill_to_bytes(void* to, size_t count, jubyte value) { | |
169 memset(to, value, count); | |
170 } | |
171 | |
172 static void pd_zero_to_words(HeapWord* tohw, size_t count) { | |
173 pd_fill_to_words(tohw, count, 0); | |
174 } | |
175 | |
176 static void pd_zero_to_bytes(void* to, size_t count) { | |
177 memset(to, 0, count); | |
178 } |