--- old/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.hpp 2017-08-22 15:36:21.549167930 +0200 +++ new/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.hpp 2017-08-22 15:36:21.385167936 +0200 @@ -51,8 +51,21 @@ inline jlong Atomic::load(const volatile jlong* src) { return *src; } -inline jint Atomic::add (jint add_value, volatile jint* dest) { - intptr_t rv; +template +struct Atomic::PlatformAdd + : Atomic::AddAndFetch > +{ + template + D add_and_fetch(I add_value, D volatile* dest) const; +}; + +template<> +template +inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { + STATIC_CAST(4 == sizeof(I)); + STATIC_CAST(4 == sizeof(D)); + + D rv; __asm__ volatile( "1: \n\t" " ld [%2], %%o2\n\t" @@ -68,8 +81,12 @@ return rv; } -inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) { - intptr_t rv; +template +inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { + STATIC_CAST(8 == sizeof(I)); + STATIC_CAST(8 == sizeof(D)); + + D rv; __asm__ volatile( "1: \n\t" " ldx [%2], %%o2\n\t" @@ -85,10 +102,9 @@ return rv; } -inline void* Atomic::add_ptr(intptr_t add_value, volatile void* dest) { - return (void*)add_ptr((intptr_t)add_value, (volatile intptr_t*)dest); -} +template<> +struct Atomic::PlatformAdd<2>: Atomic::AddShortUsingInt {}; inline jint Atomic::xchg (jint exchange_value, volatile jint* dest) { intptr_t rv = exchange_value;