RFR: 8297539: Use PrimitiveConversions::cast for local uses of the int<->float union conversion trick [v3]

Kim Barrett kbarrett at openjdk.org
Tue Mar 28 15:31:00 UTC 2023


On Tue, 28 Mar 2023 14:40:08 GMT, Afshin Zafari <duke at openjdk.org> wrote:

>> **Only** the instances of using `union` for converting `int` to `float` are replaced with call to `PrimitiveConversions::cast<To>(From)` method. Some few cases with conversion of `long` <->`double` are also replaced with `PrimitiveConversions::cast<To>(From)`. The other instances where the union contains other types of fields than `int` and `float` are left unchanged.
>> 
>> ### Test
>> local hotspot:tier1
>> mach5 tiers 1-5
>
> Afshin Zafari has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8297539: Use PrimitiveConversions::cast for local uses of the int<->float union conversion trick

Changes requested by kbarrett (Reviewer).

src/hotspot/cpu/arm/assembler_arm.hpp line 288:

> 286:     override bool f_lo_is_null() const { return (_bits & ((1 << 19) - 1)) == 0; }
> 287:     override int e() const { return ((_bits << 1) >> (23+1)) - 127; }
> 288:     override unsigned int s() const { return _bits >> 31; }

This shouldn't compile? I think `override` should be after the declarator, so between `const` and the
function body in all of these.

-------------

PR Review: https://git.openjdk.org/jdk/pull/13136#pullrequestreview-1361380232
PR Review Comment: https://git.openjdk.org/jdk/pull/13136#discussion_r1150801503


More information about the hotspot-dev mailing list