1 /*
2 * Copyright (c) 2003, 2008, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 // Inline functions for memory copy and fill.
26
27 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
28 (void)memmove(to, from, count * HeapWordSize);
29 }
30
31 static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
32 switch (count) {
33 case 8: to[7] = from[7];
34 case 7: to[6] = from[6];
35 case 6: to[5] = from[5];
36 case 5: to[4] = from[4];
37 case 4: to[3] = from[3];
38 case 3: to[2] = from[2];
39 case 2: to[1] = from[1];
40 case 1: to[0] = from[0];
41 case 0: break;
42 default: (void)memcpy(to, from, count * HeapWordSize);
43 break;
44 }
169 *to++ = v;
170 }
171 assert(count == odd, "bad bounds on loop filling to aligned words");
172 if (odd) {
173 *((juint*)to) = value;
174
175 }
176 }
177
178 static void pd_fill_to_bytes(void* to, size_t count, jubyte value) {
179 (void)memset(to, value, count);
180 }
181
182 static void pd_zero_to_words(HeapWord* tohw, size_t count) {
183 pd_fill_to_words(tohw, count, 0);
184 }
185
186 static void pd_zero_to_bytes(void* to, size_t count) {
187 (void)memset(to, 0, count);
188 }
|
1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef CPU_SPARC_VM_COPY_SPARC_HPP
26 #define CPU_SPARC_VM_COPY_SPARC_HPP
27
28 // Inline functions for memory copy and fill.
29
30 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
31 (void)memmove(to, from, count * HeapWordSize);
32 }
33
34 static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
35 switch (count) {
36 case 8: to[7] = from[7];
37 case 7: to[6] = from[6];
38 case 6: to[5] = from[5];
39 case 5: to[4] = from[4];
40 case 4: to[3] = from[3];
41 case 3: to[2] = from[2];
42 case 2: to[1] = from[1];
43 case 1: to[0] = from[0];
44 case 0: break;
45 default: (void)memcpy(to, from, count * HeapWordSize);
46 break;
47 }
172 *to++ = v;
173 }
174 assert(count == odd, "bad bounds on loop filling to aligned words");
175 if (odd) {
176 *((juint*)to) = value;
177
178 }
179 }
180
181 static void pd_fill_to_bytes(void* to, size_t count, jubyte value) {
182 (void)memset(to, value, count);
183 }
184
185 static void pd_zero_to_words(HeapWord* tohw, size_t count) {
186 pd_fill_to_words(tohw, count, 0);
187 }
188
189 static void pd_zero_to_bytes(void* to, size_t count) {
190 (void)memset(to, 0, count);
191 }
192
193 #endif // CPU_SPARC_VM_COPY_SPARC_HPP
|