author | coleenp |
Wed, 06 Jun 2018 10:45:40 -0400 | |
changeset 50429 | 83aec1d357d4 |
parent 49364 | src/hotspot/os_cpu/linux_aarch64/orderAccess_linux_aarch64.inline.hpp@601146c66cad |
child 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
29182 | 1 |
/* |
49364
601146c66cad
8173070: Remove ValueObj class for allocation subclassing for runtime code
coleenp
parents:
47609
diff
changeset
|
2 |
* Copyright (c) 2003, 2018, 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 |
||
50429
83aec1d357d4
8204301: Make OrderAccess functions available to hpp rather than inline.hpp files
coleenp
parents:
49364
diff
changeset
|
26 |
#ifndef OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP |
83aec1d357d4
8204301: Make OrderAccess functions available to hpp rather than inline.hpp files
coleenp
parents:
49364
diff
changeset
|
27 |
#define OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP |
29182 | 28 |
|
50429
83aec1d357d4
8204301: Make OrderAccess functions available to hpp rather than inline.hpp files
coleenp
parents:
49364
diff
changeset
|
29 |
// Included in orderAccess.hpp header file. |
83aec1d357d4
8204301: Make OrderAccess functions available to hpp rather than inline.hpp files
coleenp
parents:
49364
diff
changeset
|
30 |
|
29182 | 31 |
#include "vm_version_aarch64.hpp" |
32 |
||
33 |
// Implementation of class OrderAccess. |
|
34 |
||
35 |
inline void OrderAccess::loadload() { acquire(); } |
|
36 |
inline void OrderAccess::storestore() { release(); } |
|
37 |
inline void OrderAccess::loadstore() { acquire(); } |
|
38 |
inline void OrderAccess::storeload() { fence(); } |
|
39 |
||
40 |
inline void OrderAccess::acquire() { |
|
41 |
READ_MEM_BARRIER; |
|
42 |
} |
|
43 |
||
44 |
inline void OrderAccess::release() { |
|
45 |
WRITE_MEM_BARRIER; |
|
46 |
} |
|
47 |
||
48 |
inline void OrderAccess::fence() { |
|
49 |
FULL_MEM_BARRIER; |
|
50 |
} |
|
51 |
||
47609
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
52 |
template<size_t byte_size> |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
53 |
struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE> |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
54 |
{ |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
55 |
template <typename T> |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
56 |
T operator()(const volatile T* p) const { T data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; } |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
57 |
}; |
29182 | 58 |
|
47609
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
59 |
template<size_t byte_size> |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
60 |
struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X> |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
61 |
{ |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
62 |
template <typename T> |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
63 |
void operator()(T v, volatile T* p) const { __atomic_store(p, &v, __ATOMIC_RELEASE); } |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
64 |
}; |
29182 | 65 |
|
47609
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
66 |
template<size_t byte_size> |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
67 |
struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X_FENCE> |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
68 |
{ |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
69 |
template <typename T> |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
70 |
void operator()(T v, volatile T* p) const { release_store(p, v); fence(); } |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
71 |
}; |
29182 | 72 |
|
50429
83aec1d357d4
8204301: Make OrderAccess functions available to hpp rather than inline.hpp files
coleenp
parents:
49364
diff
changeset
|
73 |
#endif // OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP |