Mercurial > hg > truffle
annotate src/cpu/zero/vm/copy_zero.hpp @ 6229:d900d95bfdb0
7183754: Test runtime/6294277/Test6294277.sh runs wrong JVM
Reviewed-by: kamg, coleenp, ctornqvi
author | fparain |
---|---|
date | Mon, 16 Jul 2012 04:06:44 -0700 |
parents | f95d63e2154a |
children |
rev | line source |
---|---|
1010 | 1 /* |
1972 | 2 * Copyright (c) 2003, 2010, 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 | |
1972 | 26 #ifndef CPU_ZERO_VM_COPY_ZERO_HPP |
27 #define CPU_ZERO_VM_COPY_ZERO_HPP | |
28 | |
1010 | 29 // Inline functions for memory copy and fill. |
30 | |
31 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) { | |
32 memmove(to, from, count * HeapWordSize); | |
33 } | |
34 | |
35 static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) { | |
36 switch (count) { | |
37 case 8: to[7] = from[7]; | |
38 case 7: to[6] = from[6]; | |
39 case 6: to[5] = from[5]; | |
40 case 5: to[4] = from[4]; | |
41 case 4: to[3] = from[3]; | |
42 case 3: to[2] = from[2]; | |
43 case 2: to[1] = from[1]; | |
44 case 1: to[0] = from[0]; | |
45 case 0: break; | |
46 default: | |
47 memcpy(to, from, count * HeapWordSize); | |
48 break; | |
49 } | |
50 } | |
51 | |
52 static void pd_disjoint_words_atomic(HeapWord* from, | |
53 HeapWord* to, | |
54 size_t count) { | |
55 switch (count) { | |
56 case 8: to[7] = from[7]; | |
57 case 7: to[6] = from[6]; | |
58 case 6: to[5] = from[5]; | |
59 case 5: to[4] = from[4]; | |
60 case 4: to[3] = from[3]; | |
61 case 3: to[2] = from[2]; | |
62 case 2: to[1] = from[1]; | |
63 case 1: to[0] = from[0]; | |
64 case 0: break; | |
65 default: | |
66 while (count-- > 0) { | |
67 *to++ = *from++; | |
68 } | |
69 break; | |
70 } | |
71 } | |
72 | |
73 static void pd_aligned_conjoint_words(HeapWord* from, | |
74 HeapWord* to, | |
75 size_t count) { | |
76 memmove(to, from, count * HeapWordSize); | |
77 } | |
78 | |
79 static void pd_aligned_disjoint_words(HeapWord* from, | |
80 HeapWord* to, | |
81 size_t count) { | |
82 pd_disjoint_words(from, to, count); | |
83 } | |
84 | |
85 static void pd_conjoint_bytes(void* from, void* to, size_t count) { | |
86 memmove(to, from, count); | |
87 } | |
88 | |
89 static void pd_conjoint_bytes_atomic(void* from, void* to, size_t count) { | |
90 memmove(to, from, count); | |
91 } | |
92 | |
93 static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) { | |
94 _Copy_conjoint_jshorts_atomic(from, to, count); | |
95 } | |
96 | |
97 static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) { | |
98 _Copy_conjoint_jints_atomic(from, to, count); | |
99 } | |
100 | |
101 static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) { | |
102 _Copy_conjoint_jlongs_atomic(from, to, count); | |
103 } | |
104 | |
105 static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) { | |
106 #ifdef _LP64 | |
107 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); | |
108 _Copy_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count); | |
109 #else | |
110 assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size"); | |
111 _Copy_conjoint_jints_atomic((jint*)from, (jint*)to, count); | |
112 #endif // _LP64 | |
113 } | |
114 | |
115 static void pd_arrayof_conjoint_bytes(HeapWord* from, | |
116 HeapWord* to, | |
117 size_t count) { | |
118 _Copy_arrayof_conjoint_bytes(from, to, count); | |
119 } | |
120 | |
121 static void pd_arrayof_conjoint_jshorts(HeapWord* from, | |
122 HeapWord* to, | |
123 size_t count) { | |
124 _Copy_arrayof_conjoint_jshorts(from, to, count); | |
125 } | |
126 | |
127 static void pd_arrayof_conjoint_jints(HeapWord* from, | |
128 HeapWord* to, | |
129 size_t count) { | |
130 _Copy_arrayof_conjoint_jints(from, to, count); | |
131 } | |
132 | |
133 static void pd_arrayof_conjoint_jlongs(HeapWord* from, | |
134 HeapWord* to, | |
135 size_t count) { | |
136 _Copy_arrayof_conjoint_jlongs(from, to, count); | |
137 } | |
138 | |
139 static void pd_arrayof_conjoint_oops(HeapWord* from, | |
140 HeapWord* to, | |
141 size_t count) { | |
142 #ifdef _LP64 | |
143 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size"); | |
144 _Copy_arrayof_conjoint_jlongs(from, to, count); | |
145 #else | |
146 assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size"); | |
147 _Copy_arrayof_conjoint_jints(from, to, count); | |
148 #endif // _LP64 | |
149 } | |
150 | |
151 static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) { | |
152 #ifdef _LP64 | |
153 julong* to = (julong*) tohw; | |
154 julong v = ((julong) value << 32) | value; | |
155 #else | |
156 juint* to = (juint*) tohw; | |
157 juint v = value; | |
158 #endif // _LP64 | |
159 | |
160 while (count-- > 0) { | |
161 *to++ = v; | |
162 } | |
163 } | |
164 | |
165 static void pd_fill_to_aligned_words(HeapWord* tohw, | |
166 size_t count, | |
167 juint value) { | |
168 pd_fill_to_words(tohw, count, value); | |
169 } | |
170 | |
171 static void pd_fill_to_bytes(void* to, size_t count, jubyte value) { | |
172 memset(to, value, count); | |
173 } | |
174 | |
175 static void pd_zero_to_words(HeapWord* tohw, size_t count) { | |
176 pd_fill_to_words(tohw, count, 0); | |
177 } | |
178 | |
179 static void pd_zero_to_bytes(void* to, size_t count) { | |
180 memset(to, 0, count); | |
181 } | |
1972 | 182 |
183 #endif // CPU_ZERO_VM_COPY_ZERO_HPP |