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

Matias Saavedra Silva matsaave at openjdk.org
Mon Apr 28 15:54:49 UTC 2025


On Mon, 28 Apr 2025 15:50:00 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> Hi,
>> 
>> This fixes a typical wrong overflow check. `_bci` and `_next_bci` are both `int`, so any overflow is undefined, therefore an optimizing C++ compiler is allowed to remove this check. When looking at the x64 assembly for this, I could not find the check, so I guess that it was actually removed as well.
>
> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix indentation

Is it possible to trigger this overflow? The size of a method is limited to 65535 (see JVMS 4.11) so I'm not sure if there's a way to reach this code without an error being thrown before this. constMethod::code_size() has an assert to check this.

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

PR Comment: https://git.openjdk.org/jdk/pull/24920#issuecomment-2835714036


More information about the hotspot-runtime-dev mailing list