author | fyang |
Tue, 20 Jun 2017 17:00:07 +0800 | |
changeset 46552 | 5cebeef576b2 |
parent 46523 | cbcc0ebaa044 |
permissions | -rw-r--r-- |
29182 | 1 |
/* |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
2 |
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
29182 | 3 |
* Copyright (c) 2014, Red Hat Inc. All rights reserved. |
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 OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP |
|
27 |
#define OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP |
|
28 |
||
40655
9f644073d3a0
8157907: Incorrect inclusion of atomic.hpp instead of atomic.inline.hpp
dholmes
parents:
29182
diff
changeset
|
29 |
#include "runtime/atomic.hpp" |
29182 | 30 |
#include "runtime/orderAccess.hpp" |
31 |
#include "runtime/os.hpp" |
|
32 |
#include "vm_version_aarch64.hpp" |
|
33 |
||
34 |
// Implementation of class OrderAccess. |
|
35 |
||
36 |
inline void OrderAccess::loadload() { acquire(); } |
|
37 |
inline void OrderAccess::storestore() { release(); } |
|
38 |
inline void OrderAccess::loadstore() { acquire(); } |
|
39 |
inline void OrderAccess::storeload() { fence(); } |
|
40 |
||
41 |
inline void OrderAccess::acquire() { |
|
42 |
READ_MEM_BARRIER; |
|
43 |
} |
|
44 |
||
45 |
inline void OrderAccess::release() { |
|
46 |
WRITE_MEM_BARRIER; |
|
47 |
} |
|
48 |
||
49 |
inline void OrderAccess::fence() { |
|
50 |
FULL_MEM_BARRIER; |
|
51 |
} |
|
52 |
||
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
53 |
inline jbyte OrderAccess::load_acquire(const volatile jbyte* p) |
29182 | 54 |
{ jbyte data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
55 |
inline jshort OrderAccess::load_acquire(const volatile jshort* p) |
29182 | 56 |
{ jshort data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
57 |
inline jint OrderAccess::load_acquire(const volatile jint* p) |
29182 | 58 |
{ jint data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
59 |
inline jlong OrderAccess::load_acquire(const volatile jlong* p) |
29182 | 60 |
{ jlong data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
61 |
inline jubyte OrderAccess::load_acquire(const volatile jubyte* p) |
29182 | 62 |
{ jubyte data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
63 |
inline jushort OrderAccess::load_acquire(const volatile jushort* p) |
29182 | 64 |
{ jushort data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
65 |
inline juint OrderAccess::load_acquire(const volatile juint* p) |
29182 | 66 |
{ juint data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
67 |
inline julong OrderAccess::load_acquire(const volatile julong* p) |
29182 | 68 |
{ julong data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
69 |
inline jfloat OrderAccess::load_acquire(const volatile jfloat* p) |
29182 | 70 |
{ jfloat data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
71 |
inline jdouble OrderAccess::load_acquire(const volatile jdouble* p) |
29182 | 72 |
{ jdouble data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
46523
cbcc0ebaa044
8166651: OrderAccess::load_acquire &etc should have const parameters
kbarrett
parents:
40655
diff
changeset
|
73 |
inline intptr_t OrderAccess::load_ptr_acquire(const volatile intptr_t* p) |
29182 | 74 |
{ intptr_t data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
75 |
inline void* OrderAccess::load_ptr_acquire(const volatile void* p) |
|
76 |
{ void* data; __atomic_load((void* const volatile *)p, &data, __ATOMIC_ACQUIRE); return data; } |
|
77 |
||
78 |
inline void OrderAccess::release_store(volatile jbyte* p, jbyte v) |
|
79 |
{ __atomic_store(p, &v, __ATOMIC_RELEASE); } |
|
80 |
inline void OrderAccess::release_store(volatile jshort* p, jshort v) |
|
81 |
{ __atomic_store(p, &v, __ATOMIC_RELEASE); } |
|
82 |
inline void OrderAccess::release_store(volatile jint* p, jint v) |
|
83 |
{ __atomic_store(p, &v, __ATOMIC_RELEASE); } |
|
84 |
inline void OrderAccess::release_store(volatile jlong* p, jlong v) |
|
85 |
{ __atomic_store(p, &v, __ATOMIC_RELEASE); } |
|
86 |
inline void OrderAccess::release_store(volatile jubyte* p, jubyte v) |
|
87 |
{ __atomic_store(p, &v, __ATOMIC_RELEASE); } |
|
88 |
inline void OrderAccess::release_store(volatile jushort* p, jushort v) |
|
89 |
{ __atomic_store(p, &v, __ATOMIC_RELEASE); } |
|
90 |
inline void OrderAccess::release_store(volatile juint* p, juint v) |
|
91 |
{ __atomic_store(p, &v, __ATOMIC_RELEASE); } |
|
92 |
inline void OrderAccess::release_store(volatile julong* p, julong v) |
|
93 |
{ __atomic_store(p, &v, __ATOMIC_RELEASE); } |
|
94 |
inline void OrderAccess::release_store(volatile jfloat* p, jfloat v) |
|
95 |
{ __atomic_store(p, &v, __ATOMIC_RELEASE); } |
|
96 |
inline void OrderAccess::release_store(volatile jdouble* p, jdouble v) |
|
97 |
{ __atomic_store(p, &v, __ATOMIC_RELEASE); } |
|
98 |
inline void OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) |
|
99 |
{ __atomic_store(p, &v, __ATOMIC_RELEASE); } |
|
100 |
inline void OrderAccess::release_store_ptr(volatile void* p, void* v) |
|
101 |
{ __atomic_store((void* volatile *)p, &v, __ATOMIC_RELEASE); } |
|
102 |
||
103 |
inline void OrderAccess::store_fence(jbyte* p, jbyte v) |
|
104 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
105 |
inline void OrderAccess::store_fence(jshort* p, jshort v) |
|
106 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
107 |
inline void OrderAccess::store_fence(jint* p, jint v) |
|
108 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
109 |
inline void OrderAccess::store_fence(jlong* p, jlong v) |
|
110 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
111 |
inline void OrderAccess::store_fence(jubyte* p, jubyte v) |
|
112 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
113 |
inline void OrderAccess::store_fence(jushort* p, jushort v) |
|
114 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
115 |
inline void OrderAccess::store_fence(juint* p, juint v) |
|
116 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
117 |
inline void OrderAccess::store_fence(julong* p, julong v) |
|
118 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
119 |
inline void OrderAccess::store_fence(jfloat* p, jfloat v) |
|
120 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
121 |
inline void OrderAccess::store_fence(jdouble* p, jdouble v) |
|
122 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
123 |
inline void OrderAccess::store_ptr_fence(intptr_t* p, intptr_t v) |
|
124 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
125 |
inline void OrderAccess::store_ptr_fence(void** p, void* v) |
|
126 |
{ __atomic_store(p, &v, __ATOMIC_RELAXED); fence(); } |
|
127 |
||
128 |
inline void OrderAccess::release_store_fence(volatile jbyte* p, jbyte v) { release_store(p, v); fence(); } |
|
129 |
inline void OrderAccess::release_store_fence(volatile jshort* p, jshort v) { release_store(p, v); fence(); } |
|
130 |
inline void OrderAccess::release_store_fence(volatile jint* p, jint v) { release_store(p, v); fence(); } |
|
131 |
inline void OrderAccess::release_store_fence(volatile jlong* p, jlong v) { release_store(p, v); fence(); } |
|
132 |
inline void OrderAccess::release_store_fence(volatile jubyte* p, jubyte v) { release_store(p, v); fence(); } |
|
133 |
inline void OrderAccess::release_store_fence(volatile jushort* p, jushort v) { release_store(p, v); fence(); } |
|
134 |
inline void OrderAccess::release_store_fence(volatile juint* p, juint v) { release_store(p, v); fence(); } |
|
135 |
inline void OrderAccess::release_store_fence(volatile julong* p, julong v) { release_store(p, v); fence(); } |
|
136 |
inline void OrderAccess::release_store_fence(volatile jfloat* p, jfloat v) { release_store(p, v); fence(); } |
|
137 |
inline void OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { release_store(p, v); fence(); } |
|
138 |
||
139 |
inline void OrderAccess::release_store_ptr_fence(volatile intptr_t* p, intptr_t v) { release_store_ptr(p, v); fence(); } |
|
140 |
inline void OrderAccess::release_store_ptr_fence(volatile void* p, void* v) { release_store_ptr(p, v); fence(); } |
|
141 |
||
142 |
#endif // OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP |