JDK-8297539 : Consolidate the uses of the int<->float union conversion trick
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 20
  • Priority: P4
  • Status: New
  • Resolution: Unresolved
  • Submitted: 2022-11-24
  • Updated: 2022-11-24
Description
The fix for JDK-8295351 reemployed the basic union trick for converting  int<->float in sharedRuntime.cpp. But we also have the the existing JavaValue type which is also a union and can be used for the same conversion trick. And then we also have the cast function in metaprogramming/primitiveConversions.hpp. There may be other cases too.

It would be good if we could standardise on the use of this technique so that we don't duplicate it in numerous places.