(S) RFR: 8157904: Atomic::cmpxchg for jbyte is missing a fence on initial failure
Volker Simonis
volker.simonis at gmail.com
Mon Aug 22 14:27:38 UTC 2016
Hi,
I don't particularly like the const_casts as well.
Why not change pointer_delta to accept pointers to volatiles as well:
pointer_delta(const volatile void* left, const volatile void* right,
Notice that "const volatile void*" means a pointer to a value which
might change unexpectedly but which can not be changed by the program
itself. As the function doesn't really dereferences the pointers (i.e.
reads the values pointed to by the pointers) but only computes the
delta of the pointers themselves, this shouldn't do any harm regarding
the optimization possibilities.
Because there are standard conversion from "<type>*" to "volatile
<type>*", the new version will still work for callers which use
non-volatile arguments.
Regards,
Volker
On Mon, Aug 22, 2016 at 12:59 PM, David Holmes <david.holmes at oracle.com> wrote:
> On 22/08/2016 6:25 PM, Andrew Haley wrote:
>>
>> On 22/08/16 08:54, David Holmes wrote:
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8157904
>>>
>>> webrev: http://cr.openjdk.java.net/~dholmes/8157904/webrev/
>>
>>
>> The casting away volatile is confusing and ugly. Is the problem
>> that we don't have volatile cmpxchg() ? Or that we don't have a
>> pointer_delta() which accepts a volatile?
>
>
> The latter - pointer_delta takes const args.
>
> David
>
>> Andrew.
>>
>>
>
More information about the hotspot-runtime-dev
mailing list