RFR: JDK-8284944: # assert(cnt++ < 40) failed: infinite cycle in loop optimization

Tobias Holenstein duke at openjdk.java.net
Wed May 18 12:43:31 UTC 2022


`_loop_opts_cnt` is set to `LoopOptsCount` which can have a maximum value of 43. `_loop_opts_cnt` is decremented in `PHASE_PHASEIDEALLOOP1`, `PHASE_PHASEIDEALLOOP2` and `PHASE_PHASEIDEALLOOP3` before it reaches `PHASE_PHASEIDEALLOOP_ITERATIONS` where it is decremented further in a loop until `_loop_opts_cnt` is 0. The assert assumes that `_loop_opts_cnt` has max. value 40 in `PHASE_PHASEIDEALLOOP_ITERATIONS`. But when `PartialPeelLoop` is turned off `PHASE_PHASEIDEALLOOP2` is skipped and `_loop_opts_cnt` can have max. value 41 in `PHASE_PHASEIDEALLOOP_ITERATIONS`. Therefore the assert is wrong. 

I propose to remove the assert entirely since the loop already has a condition `_loop_opts_cnt > 0` and `_loop_opts_cnt` is decremented in every iteration.

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

Commit messages:
 - JDK-8284944: # assert(cnt++ < 40) failed: infinite cycle in loop optimization

Changes: https://git.openjdk.java.net/jdk/pull/8767/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8767&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8284944
  Stats: 122 lines in 2 files changed: 120 ins; 2 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8767.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8767/head:pull/8767

PR: https://git.openjdk.java.net/jdk/pull/8767


More information about the hotspot-compiler-dev mailing list