RFR: 8312077: Fix signed integer overflow, final part [v3]

Dean Long dlong at openjdk.org
Fri Jul 14 09:25:18 UTC 2023


On Fri, 14 Jul 2023 08:39:53 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Dean Long has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fix IndexSetWatch
>
> src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp line 557:
> 
>> 555:     }
>> 556: 
>> 557:     if (next_j <= sleep_to_next) {
> 
> It looks to me like this changes semantics so that it's now broken if `X_period_millis` wraps around. Do you actually want to change semantics in this case?

Yes, if you mean the case where X_period_millis is max_jlong, next_X is near max_jlong, and the old subtract of a negative sleep_to_next would have caused an overflow, I don't think we want to produce a sample in that case. But I could be wrong.

I had comments explaining all the pathological cases, but I guess I removed them.  The other one is when next_j < 0, next_n < 0, sleep_to_next < 0, next_j != next_n.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14883#discussion_r1263508485


More information about the hotspot-dev mailing list