RFR: JDK-8315478: GenShen: Tolerate round-off errors in preselected promotion budget
Kelvin Nilsen
kdnilsen at openjdk.org
Tue Sep 5 17:18:19 UTC 2023
On Sat, 2 Sep 2023 00:59:31 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:
>> ah, never mind, I see that you are adjusting some values there, which I missed in a first reading of the code.
>>
>> I don't understand this logic well enough to review this change, so please go ahead an land this with the review you have from William.
>
> old_consumed = old_evacuated_committed + old_available - old_evacuated_committed
> = old_available
>
> So effectively this is saying if `old_available < old_consumed`, make `old_available = old_consumed` so the subsequent assertion is satisfied. You are asserting that this can only happen if the difference is because of round-off errors.
>
> I do have a question about this, though. Can we avoid the round-off errors in the arithmetic entirely, by doing rounding in the "safe direction" (e.g. rounding down or up) at each step where rounding is needed, rather than relying on catching the condition and adjusting the values to re-establish the invariants?
It would be possible to do all round-off arithmetic more conservatively, to avoid the need for this check. The "problem" arises when the sum of individual round-off errors is different than the single round-off error for the sum of promotions. My preference would be to fix this in a separate PR if we choose to do so.
-------------
PR Review Comment: https://git.openjdk.org/shenandoah/pull/317#discussion_r1316175884
More information about the shenandoah-dev
mailing list