RFR: 8314114: Fix -Wconversion warnings in os code, primarily linux [v2]
Dean Long
dlong at openjdk.org
Fri Aug 11 20:08:58 UTC 2023
On Fri, 11 Aug 2023 16:33:41 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> What are the costs of checked_cast?
>
> checked_cast instantiates a template or two. I haven't measured code bloat. It carries risk of asserting for odd inputs that used to be truncated. In this case, it seems like a good place to have the assert. In obvious places, it seems like noise.
There are a few ways to fix code like this without changing the call site:
1. overflow func() to take the alternative type, and do the checked_cast there
2. change func() to a template function
3. Change func() to take a user-defined type whose constructor accepts both types
I've experimented with all 3 in the compiler code, but I don't know what others think of tricks like these.
I think 2) is already used it HotSpot.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15229#discussion_r1291730408
More information about the hotspot-dev
mailing list