RFR: 8186166: Generalize Atomic::cmpxchg with templates

Andrew Haley aph at redhat.com
Sat Aug 19 16:18:43 UTC 2017


On 19/08/17 15:57, Kim Barrett wrote:
>> On Aug 19, 2017, at 3:57 AM, Andrew Haley <aph at redhat.com> wrote:
>>
>> On 18/08/17 20:58, Kim Barrett wrote:
>>> BTW, the conversion technique presently used by the jmumble_cast suite
>>> is explicitly called out by gcc documentation as still being undefined
>>> behavior, even with the involvement of unions.
>>
>> Umm, what?  Can you explain this a little more?  I'd have to search
>> for what jumble_cast might be.  The union trick is well defined by
>> GCC.
> 
> jint_cast, jdouble_cast, &etc, in globalDefinitions.hpp around line
> 520 right now.  For example:
> 
> typedef union { jfloat f; jint i; } FloatIntConv;
> jint jint_cast(jfloat x) { return ((FloatIntConv*)&x)->i; }
> 
> That's *not* the union trick.

Indeed not, that certainly isn't supported.  Shame, it's so close...
:-)

-- 
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-dev mailing list