RFR: JDK-8223400 Replace some enums with static const members in hotspot/runtime

Ioi Lam ioi.lam at oracle.com
Mon Oct 21 16:37:56 UTC 2019


This looks good to me.

Thanks
- Ioi

On 10/20/19 11:45 PM, Magnus Ihse Bursie wrote:
> Hi,
>
> Can I please have a review for this fix for mixing enums with non-enums?
>
> While the patch itself may not look much to the world, it is 
> unfortunately blocking future improvements in enabling warnings in the 
> build.
>
> The first part of the fix, in klass.hpp, is lifted verbatim from 
> Rahul's fix in JDK-8213416. It was removed from that bug since the 
> rest of it targeted hotspot/compiler, and the hotspot/runtime part was 
> split out into this bug. This fix follows Kim Barrett's suggestion 
> that the enums in question should rather be static consts members.
>
> The second part of the fix, in jvm.cpp, uses the enum 
> JVM_CONSTANT_Class in a trinary operator together with a unsigned char 
> value, assigning to an unsigned char array. Unfortunately, 
> JVM_CONSTANT_Class is defined in include/classfile_constants.h from 
> java.base, so changing it is not feasible. (I believe it is an 
> exported interface, for starters.) Also, given the context, it seems 
> reasonable to keep it as an enum. Hence, the explicit cast to unsigned 
> char in jvm.cpp.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8223400
> WebRev: 
> http://cr.openjdk.java.net/~ihse/JDK-8223400-fix-hotspot-enum-warnings/webrev.01
>
> /Magnus



More information about the hotspot-runtime-dev mailing list