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

Tobias Holenstein duke at openjdk.java.net
Wed May 18 13:06:45 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.

Tobias Holenstein has updated the pull request incrementally with one additional commit since the last revision:

  reformat spaces in test

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8767/files
  - new: https://git.openjdk.java.net/jdk/pull/8767/files/e50f9442..73871c70

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8767&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8767&range=00-01

  Stats: 93 lines in 1 file changed: 5 ins; 0 del; 88 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