[jdk18] Integrated: 8278790: Inner loop of long loop nest runs for too few iterations
Roland Westrelin
roland at openjdk.java.net
Fri Dec 17 07:48:27 UTC 2021
On Thu, 16 Dec 2021 08:44:59 GMT, Roland Westrelin <roland at openjdk.org> wrote:
> Given a counted loop that iterates in [A, Z), when long range checks
> are transformed into int range checks, a loop nest is created and
> the inner loop iterates in [0, Z2).
>
> The limits of the inner loop are adjusted to guarantee no overflow for
> the range of values of the inner loop. That is for a range check:
>
> i * scale + offset <u length
>
> 1) the bounds of the inner loop are adjusted to roughly [0,
> max_jint/scale).
>
> Also, we don't want to loose what we know about the bounds of the loop
> being transformed.
>
> 2) So the bound of the inner loop are also adjusted to [0, min(Z2, Z - A))
>
> The bug here is that 2) is performed before 1). This was spotted with
> a micro benchmarks where the initial loop had only ~2000
> iterations. The transformed loop is expected to run for the same 2000
> iterations but instead ran for 2000/scale iterations.
This pull request has now been integrated.
Changeset: bb7efb35
Author: Roland Westrelin <roland at openjdk.org>
URL: https://git.openjdk.java.net/jdk18/commit/bb7efb3517b0ac66a55607c14aae3aef1f11c892
Stats: 9 lines in 1 file changed: 5 ins; 4 del; 0 mod
8278790: Inner loop of long loop nest runs for too few iterations
Reviewed-by: chagedorn, neliasso
-------------
PR: https://git.openjdk.java.net/jdk18/pull/35
More information about the hotspot-compiler-dev
mailing list