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

David Holmes dholmes at openjdk.org
Fri Jun 30 02:21:06 UTC 2023


On Thu, 29 Jun 2023 19:44:58 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/prims/methodComparator.cpp line 79:
>> 
>>> 77:   case Bytecodes::_instanceof     : {
>>> 78:     int cpi_old = s_old->get_index_u2();
>>> 79:     int cpi_new = s_new->get_index_u2();
>> 
>> These constant pool accessors like `klass_at_noresolve` currently take in `int which` but I think it's worth looking at if this is necessary. Constant pool indices and constant pool cache indices seem to both be u2 so it might be a better option to change the arguments to u2 here to avoid the need to cast.
>
> I had to change these two lines because BytecodeStream::get_index_u2 returns an int, so got the warning and this didn't need to be declared with u2.  get_index_u2() could be fixed to return a u2 but I didn't want to go that far as no casts were involved in this change.

I think this change looks "wrong" - the indices are supposed to be u2's, if the function returns an int that seems an error.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14710#discussion_r1247334013


More information about the serviceability-dev mailing list