1 /*
2 * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
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 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
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;
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 }
|
1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
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 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #ifndef CPU_ZERO_VM_COPY_ZERO_HPP
27 #define CPU_ZERO_VM_COPY_ZERO_HPP
28
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;
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 }
182
183 #endif // CPU_ZERO_VM_COPY_ZERO_HPP
|