1 /*
2 * Copyright (c) 2008, 2018, 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_LINUX_ARM_VM_COPY_LINUX_ARM_INLINE_HPP
26 #define OS_CPU_LINUX_ARM_VM_COPY_LINUX_ARM_INLINE_HPP
27
pd_conjoint_words(const HeapWord * from,HeapWord * to,size_t count)28 static void pd_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) {
29 _Copy_conjoint_words(from, to, count * HeapWordSize);
30 }
31
pd_disjoint_words(const HeapWord * from,HeapWord * to,size_t count)32 static void pd_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) {
33 _Copy_disjoint_words(from, to, count * HeapWordSize);
34 }
35
pd_disjoint_words_atomic(const HeapWord * from,HeapWord * to,size_t count)36 static void pd_disjoint_words_atomic(const HeapWord* from, HeapWord* to, size_t count) {
37 pd_disjoint_words(from, to, count);
38 }
39
pd_aligned_conjoint_words(const HeapWord * from,HeapWord * to,size_t count)40 static void pd_aligned_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) {
41 pd_conjoint_words(from, to, count);
42 }
43
pd_aligned_disjoint_words(const HeapWord * from,HeapWord * to,size_t count)44 static void pd_aligned_disjoint_words(const HeapWord* from, HeapWord* to, size_t count) {
45 pd_disjoint_words(from, to, count);
46 }
47
pd_conjoint_bytes(const void * from,void * to,size_t count)48 static void pd_conjoint_bytes(const void* from, void* to, size_t count) {
49 memmove(to, from, count);
50 }
51
pd_conjoint_bytes_atomic(const void * from,void * to,size_t count)52 static void pd_conjoint_bytes_atomic(const void* from, void* to, size_t count) {
53 pd_conjoint_bytes(from, to, count);
54 }
55
pd_conjoint_jshorts_atomic(const jshort * from,jshort * to,size_t count)56 static void pd_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) {
57 _Copy_conjoint_jshorts_atomic(from, to, count * BytesPerShort);
58 }
59
pd_conjoint_jints_atomic(const jint * from,jint * to,size_t count)60 static void pd_conjoint_jints_atomic(const jint* from, jint* to, size_t count) {
61 #ifdef AARCH64
62 _Copy_conjoint_jints_atomic(from, to, count * BytesPerInt);
63 #else
64 assert(HeapWordSize == BytesPerInt, "heapwords and jints must be the same size");
65 // pd_conjoint_words is word-atomic in this implementation.
66 pd_conjoint_words((const HeapWord*)from, (HeapWord*)to, count);
67 #endif
68 }
69
pd_conjoint_jlongs_atomic(const jlong * from,jlong * to,size_t count)70 static void pd_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) {
71 #ifdef AARCH64
72 assert(HeapWordSize == BytesPerLong, "64-bit architecture");
73 pd_conjoint_words((const HeapWord*)from, (HeapWord*)to, count);
74 #else
75 _Copy_conjoint_jlongs_atomic(from, to, count * BytesPerLong);
76 #endif
77 }
78
pd_conjoint_oops_atomic(const oop * from,oop * to,size_t count)79 static void pd_conjoint_oops_atomic(const oop* from, oop* to, size_t count) {
80 #ifdef AARCH64
81 if (UseCompressedOops) {
82 assert(BytesPerHeapOop == BytesPerInt, "compressed oops");
83 pd_conjoint_jints_atomic((const jint*)from, (jint*)to, count);
84 } else {
85 assert(BytesPerHeapOop == BytesPerLong, "64-bit architecture");
86 pd_conjoint_jlongs_atomic((const jlong*)from, (jlong*)to, count);
87 }
88 #else
89 assert(BytesPerHeapOop == BytesPerInt, "32-bit architecture");
90 pd_conjoint_jints_atomic((const jint*)from, (jint*)to, count);
91 #endif
92 }
93
pd_arrayof_conjoint_bytes(const HeapWord * from,HeapWord * to,size_t count)94 static void pd_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) {
95 pd_conjoint_bytes_atomic((const void*)from, (void*)to, count);
96 }
97
pd_arrayof_conjoint_jshorts(const HeapWord * from,HeapWord * to,size_t count)98 static void pd_arrayof_conjoint_jshorts(const HeapWord* from, HeapWord* to, size_t count) {
99 pd_conjoint_jshorts_atomic((const jshort*)from, (jshort*)to, count);
100 }
101
pd_arrayof_conjoint_jints(const HeapWord * from,HeapWord * to,size_t count)102 static void pd_arrayof_conjoint_jints(const HeapWord* from, HeapWord* to, size_t count) {
103 pd_conjoint_jints_atomic((const jint*)from, (jint*)to, count);
104 }
105
pd_arrayof_conjoint_jlongs(const HeapWord * from,HeapWord * to,size_t count)106 static void pd_arrayof_conjoint_jlongs(const HeapWord* from, HeapWord* to, size_t count) {
107 pd_conjoint_jlongs_atomic((const jlong*)from, (jlong*)to, count);
108 }
109
pd_arrayof_conjoint_oops(const HeapWord * from,HeapWord * to,size_t count)110 static void pd_arrayof_conjoint_oops(const HeapWord* from, HeapWord* to, size_t count) {
111 pd_conjoint_oops_atomic((const oop*)from, (oop*)to, count);
112 }
113
114 #endif // OS_CPU_LINUX_ARM_VM_COPY_LINUX_ARM_INLINE_HPP
115