src/hotspot/os_cpu/bsd_x86/atomic_bsd_x86.hpp
author darcy
Tue, 12 Nov 2019 10:45:23 -0800
changeset 59037 3d2575331a41
parent 53244 9807daeb47c4
child 59247 56bf71d64d51
permissions -rw-r--r--
8233940: Preview API tests for String methods should use ${jdk.version} as -source arg Reviewed-by: jlaskey, jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51996
diff changeset
     2
 * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     4
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     7
 * published by the Free Software Foundation.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     8
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    13
 * accompanied this code).
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    14
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    18
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    21
 * questions.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    22
 *
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    23
 */
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51996
diff changeset
    25
#ifndef OS_CPU_BSD_X86_ATOMIC_BSD_X86_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51996
diff changeset
    26
#define OS_CPU_BSD_X86_ATOMIC_BSD_X86_HPP
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    27
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    28
// Implementation of class atomic
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    29
46993
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    30
template<size_t byte_size>
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    31
struct Atomic::PlatformAdd
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    32
  : Atomic::FetchAndAdd<Atomic::PlatformAdd<byte_size> >
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    33
{
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    34
  template<typename I, typename D>
50029
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
    35
  D fetch_and_add(I add_value, D volatile* dest, atomic_memory_order /* order */) const;
46993
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    36
};
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    37
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    38
template<>
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    39
template<typename I, typename D>
50029
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
    40
inline D Atomic::PlatformAdd<4>::fetch_and_add(I add_value, D volatile* dest,
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
    41
                                               atomic_memory_order /* order */) const {
46993
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    42
  STATIC_ASSERT(4 == sizeof(I));
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    43
  STATIC_ASSERT(4 == sizeof(D));
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    44
  D old_value;
46414
5d1d862dc8d8 8169061: Drop os::is_MP checks from Atomics
shade
parents: 40655
diff changeset
    45
  __asm__ volatile (  "lock xaddl %0,(%2)"
46993
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    46
                    : "=r" (old_value)
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    47
                    : "0" (add_value), "r" (dest)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    48
                    : "cc", "memory");
46993
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    49
  return old_value;
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    50
}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    51
47578
09c41c4913d9 8187977: Generalize Atomic::xchg to use templates
eosterlund
parents: 47552
diff changeset
    52
template<>
09c41c4913d9 8187977: Generalize Atomic::xchg to use templates
eosterlund
parents: 47552
diff changeset
    53
template<typename T>
09c41c4913d9 8187977: Generalize Atomic::xchg to use templates
eosterlund
parents: 47552
diff changeset
    54
inline T Atomic::PlatformXchg<4>::operator()(T exchange_value,
50029
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
    55
                                             T volatile* dest,
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
    56
                                             atomic_memory_order /* order */) const {
47578
09c41c4913d9 8187977: Generalize Atomic::xchg to use templates
eosterlund
parents: 47552
diff changeset
    57
  STATIC_ASSERT(4 == sizeof(T));
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    58
  __asm__ volatile (  "xchgl (%2),%0"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    59
                    : "=r" (exchange_value)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    60
                    : "0" (exchange_value), "r" (dest)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    61
                    : "memory");
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    62
  return exchange_value;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    63
}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    64
46958
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    65
template<>
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    66
template<typename T>
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    67
inline T Atomic::PlatformCmpxchg<1>::operator()(T exchange_value,
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    68
                                                T volatile* dest,
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    69
                                                T compare_value,
50029
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
    70
                                                atomic_memory_order /* order */) const {
46958
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    71
  STATIC_ASSERT(1 == sizeof(T));
46414
5d1d862dc8d8 8169061: Drop os::is_MP checks from Atomics
shade
parents: 40655
diff changeset
    72
  __asm__ volatile (  "lock cmpxchgb %1,(%3)"
27691
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 25715
diff changeset
    73
                    : "=a" (exchange_value)
46414
5d1d862dc8d8 8169061: Drop os::is_MP checks from Atomics
shade
parents: 40655
diff changeset
    74
                    : "q" (exchange_value), "a" (compare_value), "r" (dest)
27691
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 25715
diff changeset
    75
                    : "cc", "memory");
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 25715
diff changeset
    76
  return exchange_value;
733f189ad1f7 8058255: Native jbyte Atomic::cmpxchg for supported x86 platforms
jwilhelm
parents: 25715
diff changeset
    77
}
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    78
46958
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    79
template<>
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    80
template<typename T>
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    81
inline T Atomic::PlatformCmpxchg<4>::operator()(T exchange_value,
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    82
                                                T volatile* dest,
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    83
                                                T compare_value,
50029
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
    84
                                                atomic_memory_order /* order */) const {
46958
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
    85
  STATIC_ASSERT(4 == sizeof(T));
46414
5d1d862dc8d8 8169061: Drop os::is_MP checks from Atomics
shade
parents: 40655
diff changeset
    86
  __asm__ volatile (  "lock cmpxchgl %1,(%3)"
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    87
                    : "=a" (exchange_value)
46414
5d1d862dc8d8 8169061: Drop os::is_MP checks from Atomics
shade
parents: 40655
diff changeset
    88
                    : "r" (exchange_value), "a" (compare_value), "r" (dest)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    89
                    : "cc", "memory");
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    90
  return exchange_value;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    91
}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    92
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
    93
#ifdef AMD64
46993
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    94
template<>
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    95
template<typename I, typename D>
50029
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
    96
inline D Atomic::PlatformAdd<8>::fetch_and_add(I add_value, D volatile* dest,
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
    97
                                               atomic_memory_order /* order */) const {
46993
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    98
  STATIC_ASSERT(8 == sizeof(I));
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
    99
  STATIC_ASSERT(8 == sizeof(D));
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
   100
  D old_value;
46414
5d1d862dc8d8 8169061: Drop os::is_MP checks from Atomics
shade
parents: 40655
diff changeset
   101
  __asm__ __volatile__ (  "lock xaddq %0,(%2)"
46993
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
   102
                        : "=r" (old_value)
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
   103
                        : "0" (add_value), "r" (dest)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   104
                        : "cc", "memory");
46993
dd0f91c85ffc 8186476: Generalize Atomic::add with templates
eosterlund
parents: 46958
diff changeset
   105
  return old_value;
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   106
}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   107
47578
09c41c4913d9 8187977: Generalize Atomic::xchg to use templates
eosterlund
parents: 47552
diff changeset
   108
template<>
09c41c4913d9 8187977: Generalize Atomic::xchg to use templates
eosterlund
parents: 47552
diff changeset
   109
template<typename T>
09c41c4913d9 8187977: Generalize Atomic::xchg to use templates
eosterlund
parents: 47552
diff changeset
   110
inline T Atomic::PlatformXchg<8>::operator()(T exchange_value,
50029
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
   111
                                             T volatile* dest,
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
   112
                                             atomic_memory_order /* order */) const {
47578
09c41c4913d9 8187977: Generalize Atomic::xchg to use templates
eosterlund
parents: 47552
diff changeset
   113
  STATIC_ASSERT(8 == sizeof(T));
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   114
  __asm__ __volatile__ ("xchgq (%2),%0"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   115
                        : "=r" (exchange_value)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   116
                        : "0" (exchange_value), "r" (dest)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   117
                        : "memory");
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   118
  return exchange_value;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   119
}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   120
46958
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   121
template<>
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   122
template<typename T>
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   123
inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value,
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   124
                                                T volatile* dest,
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   125
                                                T compare_value,
50029
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
   126
                                                atomic_memory_order /* order */) const {
46958
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   127
  STATIC_ASSERT(8 == sizeof(T));
46414
5d1d862dc8d8 8169061: Drop os::is_MP checks from Atomics
shade
parents: 40655
diff changeset
   128
  __asm__ __volatile__ (  "lock cmpxchgq %1,(%3)"
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   129
                        : "=a" (exchange_value)
46414
5d1d862dc8d8 8169061: Drop os::is_MP checks from Atomics
shade
parents: 40655
diff changeset
   130
                        : "r" (exchange_value), "a" (compare_value), "r" (dest)
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   131
                        : "cc", "memory");
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   132
  return exchange_value;
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   133
}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   134
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   135
#else // !AMD64
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   136
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   137
extern "C" {
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   138
  // defined in bsd_x86.s
51996
84743156e780 8188764: Obsolete AssumeMP and then remove all support for non-MP builds
dholmes
parents: 50029
diff changeset
   139
  int64_t _Atomic_cmpxchg_long(int64_t, volatile int64_t*, int64_t);
48468
7cc7de9bf4a4 8186903: Remove j-types from Atomic
coleenp
parents: 47593
diff changeset
   140
  void _Atomic_move_long(const volatile int64_t* src, volatile int64_t* dst);
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   141
}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   142
46958
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   143
template<>
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   144
template<typename T>
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   145
inline T Atomic::PlatformCmpxchg<8>::operator()(T exchange_value,
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   146
                                                T volatile* dest,
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   147
                                                T compare_value,
50029
ea0a16ba6ac0 8202080: Introduce ordering semantics for Atomic::add and other RMW atomics
mdoerr
parents: 48468
diff changeset
   148
                                                atomic_memory_order /* order */) const {
46958
a13bd8c6b7a2 8186166: Generalize Atomic::cmpxchg with templates
eosterlund
parents: 46523
diff changeset
   149
  STATIC_ASSERT(8 == sizeof(T));
48468
7cc7de9bf4a4 8186903: Remove j-types from Atomic
coleenp
parents: 47593
diff changeset
   150
  return cmpxchg_using_helper<int64_t>(_Atomic_cmpxchg_long, exchange_value, dest, compare_value);
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   151
}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   152
47593
2d56326b98f0 8188224: Generalize Atomic::load/store to use templates
eosterlund
parents: 47578
diff changeset
   153
template<>
2d56326b98f0 8188224: Generalize Atomic::load/store to use templates
eosterlund
parents: 47578
diff changeset
   154
template<typename T>
2d56326b98f0 8188224: Generalize Atomic::load/store to use templates
eosterlund
parents: 47578
diff changeset
   155
inline T Atomic::PlatformLoad<8>::operator()(T const volatile* src) const {
2d56326b98f0 8188224: Generalize Atomic::load/store to use templates
eosterlund
parents: 47578
diff changeset
   156
  STATIC_ASSERT(8 == sizeof(T));
48468
7cc7de9bf4a4 8186903: Remove j-types from Atomic
coleenp
parents: 47593
diff changeset
   157
  volatile int64_t dest;
7cc7de9bf4a4 8186903: Remove j-types from Atomic
coleenp
parents: 47593
diff changeset
   158
  _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(src), reinterpret_cast<volatile int64_t*>(&dest));
47593
2d56326b98f0 8188224: Generalize Atomic::load/store to use templates
eosterlund
parents: 47578
diff changeset
   159
  return PrimitiveConversions::cast<T>(dest);
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   160
}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   161
47593
2d56326b98f0 8188224: Generalize Atomic::load/store to use templates
eosterlund
parents: 47578
diff changeset
   162
template<>
2d56326b98f0 8188224: Generalize Atomic::load/store to use templates
eosterlund
parents: 47578
diff changeset
   163
template<typename T>
2d56326b98f0 8188224: Generalize Atomic::load/store to use templates
eosterlund
parents: 47578
diff changeset
   164
inline void Atomic::PlatformStore<8>::operator()(T store_value,
2d56326b98f0 8188224: Generalize Atomic::load/store to use templates
eosterlund
parents: 47578
diff changeset
   165
                                                 T volatile* dest) const {
2d56326b98f0 8188224: Generalize Atomic::load/store to use templates
eosterlund
parents: 47578
diff changeset
   166
  STATIC_ASSERT(8 == sizeof(T));
48468
7cc7de9bf4a4 8186903: Remove j-types from Atomic
coleenp
parents: 47593
diff changeset
   167
  _Atomic_move_long(reinterpret_cast<const volatile int64_t*>(&store_value), reinterpret_cast<volatile int64_t*>(dest));
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   168
}
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   169
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   170
#endif // AMD64
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents:
diff changeset
   171
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51996
diff changeset
   172
#endif // OS_CPU_BSD_X86_ATOMIC_BSD_X86_HPP