RFR: 8313554: Fix -Wconversion warnings for ResolvedFieldEntry [v2]

Dean Long dlong at openjdk.org
Thu Aug 3 22:45:31 UTC 2023


On Thu, 3 Aug 2023 19:15:30 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> As far as I've designed it, only the last two bits of the flags are ever set or used. C++ booleans are either 0 or 1 so the higher bits should never be set.
>
> It is only two bits and the only variable here "is_final_shift" is 1.  This could use 1 to make it obvious but the variable is used in the templateInterpreter code.  Again, I think this is good.  This is never going to be a bug.

It's fine unless the shift values get changed so the value no longer fits in u1.  Then it fails silently.
As an alternative to checked_cast, how about something like:

assert(is_final() == is_final, "");
assert(is_volatile() == is_volatile, "");

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15126#discussion_r1283787162



More information about the build-dev mailing list