RFR: 8311583: tableswitch broken by JDK-8310577 [v2]
Coleen Phillimore
coleenp at openjdk.org
Fri Jul 7 17:02:01 UTC 2023
On Fri, 7 Jul 2023 04:11:30 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>>
>> David's feedback.
>
> src/hotspot/share/interpreter/bytecodes.cpp line 390:
>
>> 388: // Promote calculation to 64 bits to do range checks, used by the verifier.
>> 389: int64_t lo = (int)Bytes::get_Java_u4(aligned_bcp + 1*jintSize);
>> 390: int64_t hi = (int)Bytes::get_Java_u4(aligned_bcp + 2*jintSize);
>
> Are the int casts needed?
Yes they are. get_Java_u4 returns u4 (unsigned) and the 'int' cast sign extends it to int, then further sign extended to int64_t for the length calculation. The tableswitch bytecode operands are signed int.
static inline u4 get_Java_u4(address p) { return get_Java<u4>(p); }
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14788#discussion_r1256138404
More information about the hotspot-runtime-dev
mailing list