author | naoto |
Tue, 09 Jul 2019 08:05:38 -0700 | |
changeset 55627 | 9c1885fb2a42 |
parent 54707 | 8390399b09f9 |
child 59247 | 56bf71d64d51 |
permissions | -rw-r--r-- |
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51050
diff
changeset
|
2 |
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
54707
8390399b09f9
8223248: [AIX] Remove old xlC 10 workaround for load acquire
mdoerr
parents:
54323
diff
changeset
|
3 |
* Copyright (c) 2012, 2019 SAP SE. All rights reserved. |
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
5 |
* |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
9 |
* |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
14 |
* accompanied this code). |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
15 |
* |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License version |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
19 |
* |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
21 |
* or visit www.oracle.com if you need additional information or have any |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
22 |
* questions. |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
23 |
* |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
24 |
*/ |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
25 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51050
diff
changeset
|
26 |
#ifndef OS_CPU_AIX_PPC_ORDERACCESS_AIX_PPC_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51050
diff
changeset
|
27 |
#define OS_CPU_AIX_PPC_ORDERACCESS_AIX_PPC_HPP |
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
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. |
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
30 |
|
29456
cc1c5203e60d
7143664: Clean up OrderAccess implementations and usage
dholmes
parents:
25715
diff
changeset
|
31 |
// Compiler version last used for testing: xlc 12 |
cc1c5203e60d
7143664: Clean up OrderAccess implementations and usage
dholmes
parents:
25715
diff
changeset
|
32 |
// Please update this information when this file changes |
cc1c5203e60d
7143664: Clean up OrderAccess implementations and usage
dholmes
parents:
25715
diff
changeset
|
33 |
|
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
34 |
// Implementation of class OrderAccess. |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
35 |
|
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
36 |
// |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
37 |
// Machine barrier instructions: |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
38 |
// |
22861 | 39 |
// - sync Two-way memory barrier, aka fence. |
40 |
// - lwsync orders Store|Store, |
|
41 |
// Load|Store, |
|
42 |
// Load|Load, |
|
43 |
// but not Store|Load |
|
44 |
// - eieio orders Store|Store |
|
45 |
// - isync Invalidates speculatively executed instructions, |
|
46 |
// but isync may complete before storage accesses |
|
47 |
// associated with instructions preceding isync have |
|
48 |
// been performed. |
|
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
49 |
// |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
50 |
// Semantic barrier instructions: |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
51 |
// (as defined in orderAccess.hpp) |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
52 |
// |
22861 | 53 |
// - release orders Store|Store, (maps to lwsync) |
54 |
// Load|Store |
|
55 |
// - acquire orders Load|Store, (maps to lwsync) |
|
56 |
// Load|Load |
|
57 |
// - fence orders Store|Store, (maps to sync) |
|
58 |
// Load|Store, |
|
59 |
// Load|Load, |
|
60 |
// Store|Load |
|
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
61 |
// |
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
62 |
|
22861 | 63 |
#define inlasm_sync() __asm__ __volatile__ ("sync" : : : "memory"); |
64 |
#define inlasm_lwsync() __asm__ __volatile__ ("lwsync" : : : "memory"); |
|
65 |
#define inlasm_eieio() __asm__ __volatile__ ("eieio" : : : "memory"); |
|
66 |
#define inlasm_isync() __asm__ __volatile__ ("isync" : : : "memory"); |
|
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
67 |
// Use twi-isync for load_acquire (faster than lwsync). |
54707
8390399b09f9
8223248: [AIX] Remove old xlC 10 workaround for load acquire
mdoerr
parents:
54323
diff
changeset
|
68 |
#define inlasm_acquire_reg(X) __asm__ __volatile__ ("twi 0,%0,0\n isync\n" : : "r" (X) : "memory"); |
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
69 |
|
29456
cc1c5203e60d
7143664: Clean up OrderAccess implementations and usage
dholmes
parents:
25715
diff
changeset
|
70 |
inline void OrderAccess::loadload() { inlasm_lwsync(); } |
cc1c5203e60d
7143664: Clean up OrderAccess implementations and usage
dholmes
parents:
25715
diff
changeset
|
71 |
inline void OrderAccess::storestore() { inlasm_lwsync(); } |
cc1c5203e60d
7143664: Clean up OrderAccess implementations and usage
dholmes
parents:
25715
diff
changeset
|
72 |
inline void OrderAccess::loadstore() { inlasm_lwsync(); } |
cc1c5203e60d
7143664: Clean up OrderAccess implementations and usage
dholmes
parents:
25715
diff
changeset
|
73 |
inline void OrderAccess::storeload() { inlasm_sync(); } |
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
74 |
|
29456
cc1c5203e60d
7143664: Clean up OrderAccess implementations and usage
dholmes
parents:
25715
diff
changeset
|
75 |
inline void OrderAccess::acquire() { inlasm_lwsync(); } |
cc1c5203e60d
7143664: Clean up OrderAccess implementations and usage
dholmes
parents:
25715
diff
changeset
|
76 |
inline void OrderAccess::release() { inlasm_lwsync(); } |
cc1c5203e60d
7143664: Clean up OrderAccess implementations and usage
dholmes
parents:
25715
diff
changeset
|
77 |
inline void OrderAccess::fence() { inlasm_sync(); } |
54323 | 78 |
inline void OrderAccess::cross_modify_fence() |
79 |
{ inlasm_isync(); } |
|
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
80 |
|
47609
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
81 |
template<size_t byte_size> |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
82 |
struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE> |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
83 |
{ |
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
84 |
template <typename T> |
51050
96ea37459ca7
8207011: Remove uses of the register storage class specifier
mikael
parents:
50429
diff
changeset
|
85 |
T operator()(const volatile T* p) const { T t = Atomic::load(p); inlasm_acquire_reg(t); return t; } |
47609
a1f68e415b48
8188813: Generalize OrderAccess to use templates
eosterlund
parents:
47216
diff
changeset
|
86 |
}; |
22831
1e2ba1d62103
8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff
changeset
|
87 |
|
22861 | 88 |
#undef inlasm_sync |
89 |
#undef inlasm_lwsync |
|
90 |
#undef inlasm_eieio |
|
91 |
#undef inlasm_isync |
|
29456
cc1c5203e60d
7143664: Clean up OrderAccess implementations and usage
dholmes
parents:
25715
diff
changeset
|
92 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
51050
diff
changeset
|
93 |
#endif // OS_CPU_AIX_PPC_ORDERACCESS_AIX_PPC_HPP |