src/hotspot/os_cpu/linux_zero/atomic_linux_zero.hpp
changeset 59249 29b0d0b61615
parent 59248 e92153ed8bdc
child 59251 4cbfa5077d68
equal deleted inserted replaced
59248:e92153ed8bdc 59249:29b0d0b61615
    32 
    32 
    33 template<size_t byte_size>
    33 template<size_t byte_size>
    34 struct Atomic::PlatformAdd
    34 struct Atomic::PlatformAdd
    35   : Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> >
    35   : Atomic::AddAndFetch<Atomic::PlatformAdd<byte_size> >
    36 {
    36 {
    37   template<typename I, typename D>
    37   template<typename D, typename I>
    38   D add_and_fetch(I add_value, D volatile* dest, atomic_memory_order order) const;
    38   D add_and_fetch(D volatile* dest, I add_value, atomic_memory_order order) const;
    39 };
    39 };
    40 
    40 
    41 template<>
    41 template<>
    42 template<typename I, typename D>
    42 template<typename D, typename I>
    43 inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest,
    43 inline D Atomic::PlatformAdd<4>::add_and_fetch(D volatile* dest, I add_value,
    44                                                atomic_memory_order order) const {
    44                                                atomic_memory_order order) const {
    45   STATIC_ASSERT(4 == sizeof(I));
    45   STATIC_ASSERT(4 == sizeof(I));
    46   STATIC_ASSERT(4 == sizeof(D));
    46   STATIC_ASSERT(4 == sizeof(D));
    47 
    47 
    48   return __sync_add_and_fetch(dest, add_value);
    48   return __sync_add_and_fetch(dest, add_value);
    49 }
    49 }
    50 
    50 
    51 template<>
    51 template<>
    52 template<typename I, typename D>
    52 template<typename D, typename I>
    53 inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest,
    53 inline D Atomic::PlatformAdd<8>::add_and_fetch(D volatile* dest, I add_value,
    54                                                atomic_memory_order order) const {
    54                                                atomic_memory_order order) const {
    55   STATIC_ASSERT(8 == sizeof(I));
    55   STATIC_ASSERT(8 == sizeof(I));
    56   STATIC_ASSERT(8 == sizeof(D));
    56   STATIC_ASSERT(8 == sizeof(D));
    57   return __sync_add_and_fetch(dest, add_value);
    57   return __sync_add_and_fetch(dest, add_value);
    58 }
    58 }