RFR: 8281213: Unsafe uses of long and size_t in MemReporterBase::diff_in_current_scale [v3]

Afshin Zafari duke at openjdk.org
Tue Dec 20 08:59:49 UTC 2022


On Mon, 19 Dec 2022 23:13:04 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> wrote:

>> I couldn't follow your idea.
>> The `INT64_MAX + 1` results in compiler overflow error.  Isn't it equal to `INT64_MIN`?
>
> I did not know there was a defect report [#1313](https://cplusplus.github.io/CWG/issues/1313.html) fixed in C++11.
> Now the standard prohibits to use constant expressions like `INT64_MAX + 1` in code.
> 
>> I couldn't follow your idea.
> 
> The idea is to show that if you want to handle -(2^63), you need more code. Your comment is not correct. The code does not handle INT64_MIN.
> 
> If we limit cases to [-(2^63 - 1), 2^63 - 1] the code would be simpler. IMHO one byte does not worth to increase the code complexity. In most cases -(2^63) would be a result of some wrong calculations.

What is the replacement for `INT64_MAX + 1` in our code?

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

PR: https://git.openjdk.org/jdk/pull/11514


More information about the hotspot-runtime-dev mailing list