[jdk18] RFR: 8278790: Inner loop of long loop nest runs for too few iterations [v2]
Roland Westrelin
roland at openjdk.java.net
Thu Dec 16 09:13:40 UTC 2021
> 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.
Roland Westrelin has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
fix
-------------
Changes:
- all: https://git.openjdk.java.net/jdk18/pull/35/files
- new: https://git.openjdk.java.net/jdk18/pull/35/files/7bd126da..75722665
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk18&pr=35&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk18&pr=35&range=00-01
Stats: 200 lines in 9 files changed: 53 ins; 125 del; 22 mod
Patch: https://git.openjdk.java.net/jdk18/pull/35.diff
Fetch: git fetch https://git.openjdk.java.net/jdk18 pull/35/head:pull/35
PR: https://git.openjdk.java.net/jdk18/pull/35
More information about the hotspot-compiler-dev
mailing list