On Thu, 29 Jun 2023 19:51:43 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:

>> src/hotspot/share/prims/jvmtiRedefineClasses.cpp line 2195:
>> 
>>> 2193:       case Bytecodes::_ldc:
>>> 2194:       {
>>> 2195:         u1 cp_index = *(bcp + 1);
>> 
>> Constant pool indices are usually u2, why does this need to be a u1?
>
> This could be a u2 to avoid confusion.  Since it's ldc, the cp_index in the 
> ldc bytecode is only a u1 but this didn't get a Wconversion error so I should 
> probably keep it as int.
> Edit: the bcp offset fetched is a u1 (byte) size, but we assign cp_index into 
> new_index below so cp_index needs to be smaller than new_index.  That's why I 
> changed it.  Making it u1 is more precise and doesn't have warnings.

I agree - using u1 to match the spec is a good thing here.

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

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

Reply via email to