1 /*
2 * Copyright (c) 2003, 2004, 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 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);
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 }
|
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 OS_CPU_SOLARIS_X86_VM_COPY_SOLARIS_X86_INLINE_HPP
26 #define OS_CPU_SOLARIS_X86_VM_COPY_SOLARIS_X86_INLINE_HPP
27
28 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
29 (void)memmove(to, from, count * HeapWordSize);
30 }
31
32 static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
33 #ifndef AMD64
34 (void)memcpy(to, from, count * HeapWordSize);
35 #else
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 (void)memcpy(to, from, count * HeapWordSize);
122 _Copy_arrayof_conjoint_jints(from, to, count);
123 }
124
125 static void pd_arrayof_conjoint_jlongs(HeapWord* from, HeapWord* to, size_t count) {
126 #ifdef AMD64
127 _Copy_arrayof_conjoint_jlongs(from, to, count);
128 #else
129 pd_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
130 #endif // AMD64
131 }
132
133 static void pd_arrayof_conjoint_oops(HeapWord* from, HeapWord* to, size_t count) {
134 #ifdef AMD64
135 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
136 _Copy_arrayof_conjoint_jlongs(from, to, count);
137 #else
138 assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size");
139 _Copy_arrayof_conjoint_jints(from, to, count);
140 #endif // AMD64
141 }
142
143 #endif // OS_CPU_SOLARIS_X86_VM_COPY_SOLARIS_X86_INLINE_HPP
|