RFR (XXS) 8037295: Add size_t versions of Atomic::add, dec, and inc
David Holmes
david.holmes at oracle.com
Wed Mar 26 11:46:20 UTC 2014
On 26/03/2014 7:55 PM, David Simms wrote:
> On 26/03/2014 10:23 a.m., David Holmes wrote:
>>
>> This looks okay to me. Is there any reason not to provide xchg and
>> cmpxchg size_t variants too?
>>
>> Thanks,
>> David H.
>>
>
> There seems to be only one currently valid use (task queue), but it
> still requires casting...then there's a requirement for some ugly macro
> to check if "size_t == unsigned int"...in which case we already have
> those variants, i.e.:
>
> +#if (UINT_MAX == SIZE_MAX) // size_t is an "unsigned int"
> +#define ATOMIC_SIZE_T_IS_UINT
> +#endif
> +
>
> +#ifndef ATOMIC_SIZE_T_IS_UINT // else we already have it
> + inline static size_t cmpxchg (size_t exchange_value, volatile
> size_t* dest, size_t compare_value);
> +#endif
>
> I didn't find this appealing (tried to see if templates made it
> better...but this was even worse), and therefore chickened out.
Ah I'd missed the fact we already have a uint version that causes an
overload conflict. These typedefs seems to cause more problems than they
fix.
Thanks,
David
> Thanks for the review.
> /Mr. Simms
More information about the hotspot-runtime-dev
mailing list