RFR: 8186166: Generalize Atomic::cmpxchg with templates

Andrew Dinn adinn at redhat.com
Fri Aug 18 13:46:44 UTC 2017


On 18/08/17 14:23, Andrew Haley wrote:
> This hunk was missing the parameter declaration of order.  Fixed thusly:
> 
> diff -r 214a94e9366c src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.hpp
> --- a/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.hpp	Mon Jul 17 12:11:32 2017 +0000
> +++ b/src/os_cpu/linux_aarch64/vm/atomic_linux_aarch64.hpp	Fri Aug 18 14:22:19 2017 +0100
> @@ -85,9 +85,12 @@
>                             (volatile intptr_t*) dest);
>  }
> 
> -template <typename T> T generic_cmpxchg(T exchange_value, volatile T* dest,
> -                                        T compare_value, cmpxchg_memory_order order)
> -{
> +template<size_t byte_size>
> +template<typename T>
> +inline T Atomic::PlatformCmpxchg<byte_size>::operator()(T exchange_value,
> +                                                        T volatile* dest,
> +                                                        T compare_value,
> +                                                        cmpxchg_memory_order order) const {
>    if (order == memory_order_relaxed) {
>      T value = compare_value;
>      __atomic_compare_exchange(dest, &value, &exchange_value, /*weak*/false,
> @@ -98,17 +101,6 @@
>    }
>  }
I believe that has already been fixed in the latest version of the patch at:

  http://cr.openjdk.java.net/~kbarrett/8186166/hotspot.03


regards,


Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander


More information about the hotspot-dev mailing list