RFR: 8313249: Fix -Wconversion warnings in verifier code

Coleen Phillimore coleenp at openjdk.org
Fri Jul 28 21:43:53 UTC 2023


On Fri, 28 Jul 2023 19:11:11 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> See bugid for comments.  Most of the verifier code deals with ints, so the u2 and other parameters weren't really needed and can be promoted to int. Mostly types are changed, but a few checked_cast<>s are added.
>> Tested with tier1-4, sanity Oracle platforms.
>
> src/hotspot/share/classfile/stackMapTableFormat.hpp line 552:
> 
>> 550:   static u1 appends_to_frame_type(int appends) {
>> 551:     assert(appends > 0 && appends < 4, "Invalid append amount");
>> 552:     return (u1)(251 + appends);
> 
> This should use `checked_cast<u1>`

This one clearly is < u1 since it checks the value for appends.

> src/hotspot/share/interpreter/bytecode.hpp line 74:
> 
>> 72: 
>> 73:   // Static functions for parsing bytecodes in place.
>> 74:   u1 get_index_u1(Bytecodes::Code bc) const {
> 
> We have a mix of u1 and jubyte in these functions. That looks odd. I am not sure whether we should fix that.

We've been trying to get away from the j<int> types but they persist in old code. Most of the classfile code prefers to use u1, u2 etc, so that's why I picked that especially for the function that's called get_index_u1.  I changed a couple of nearby jubyte to u1.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15056#discussion_r1278098044
PR Review Comment: https://git.openjdk.org/jdk/pull/15056#discussion_r1278098752


More information about the hotspot-runtime-dev mailing list