RFR: 8355711: Fix incorrect overflow check in RawBytecodeStream::raw_next [v2]

Dean Long dlong at openjdk.org
Tue Apr 29 22:59:46 UTC 2025


On Tue, 29 Apr 2025 05:51:36 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> src/hotspot/share/interpreter/bytecodeStream.hpp line 139:
>> 
>>> 137:              && code != Bytecodes::_lookupswitch, "can't be special bytecode");
>>> 138:       _is_wide = false;
>>> 139:       if (INT_MAX - len <= _next_bci) { // Check for integer overflow
>> 
>> I don't see how we can ever hit this case, given the `_bci <= _end_bci - len` test above.
>
> Hm, that seems right. Then the integer overflow check never did anything at all, anyway, right?

It looks that way.  In a product build it seems to get completely optimized out.  Unless I'm missing something, it should be safe to remove.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24920#discussion_r2067554182


More information about the hotspot-runtime-dev mailing list