RFR (M): 8184334: Generalizing Atomic with templates
Andrew Haley
aph at redhat.com
Fri Jul 21 16:31:29 UTC 2017
On 21/07/17 17:08, Erik Österlund wrote:
>> With regard to a solution, I feel there may be a much simpler answer.
>> But in order to sketch out that simpler answer, I need to know exactly
>> what problem is being solved. I presume that there is a need to turn
>> a call to a generalized function such as
>>
>> template <typename T, typename U>
>> inline static void store(T store_value, volatile U* dest);
>>
>> into a call to one of a number of specialized functions such as
>>
>> template <>
>> inline void Atomic::specialized_store<int64_t>(int64_t store_value, volatile int64_t* dest) {
>> _Atomic_move_long(&store_value, dest);
>> }
> Yes that's about it. Without messing things up of course w.r.t T and U
> having different signedness, size and type.
OK. I'll sketch out a solution. It might not work, but I'll try.
Thanks for your patience: I don't usually push back so hard when
reviewing stuff, but I think this code is very important.
>> and also perform some suitable magic for floating-point types. But do
>> we ever use atomic floats for anything? Will we ever?
>>
> That is a good point. I am not certain. But the current API supports it,
> so it seemed like a good idea to continue supporting it.
--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the hotspot-runtime-dev
mailing list