RFR: 8311077: Fix -Wconversion warnings in jvmti code [v4]

David Holmes dholmes at openjdk.org
Mon Jul 3 01:10:56 UTC 2023


On Fri, 30 Jun 2023 13:10:06 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Please review change for mostly fixing return types in the constant pool and metadata to fix -Wconversion warnings in JVMTI code.  The order of preference for changes are: 1. change the types to more distinct types (fields in the constant pool are u2 because that's their size in the classfile), 2. add direct int casts if the value has been checked in asserts above, and 3. checked_cast<> if not verified, and 4. added some pointer_delta_as_ints where needed.
>> Tested with tier1-4.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   David's suggestions.

As a general rule I'd prefer to see the lowest-level functions use the types of the actual thing they are exposing - so for anything CP related we return u1/u2/u4 - and then have higher-level code do any convenience conversions. But I realize this is tricky to deal with and there are alternatives and trade-offs in where these warnings get silenced.

Thanks.

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

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14710#pullrequestreview-1510139930


More information about the serviceability-dev mailing list