review (M) for 7024475: loop doesn't terminate when compiled
tom.rodriguez at oracle.com
Fri Mar 25 11:42:29 PDT 2011
7024475: loop doesn't terminate when compiled
The code which replaces an empty loop with the final computed value
only works correctly if the the loop is guaranteed to execute once
since it replaces the conditionally executed loop body with a value.
Loop transformations like peeling generally result in zero trip guards
being generated but they aren't required to be there. The fix is to
make sure we have a guard by peeling the loop first. This results in
a small redundant test in some cases. I added a check for obvious
ones, which occurred in scimark SOR. Main and post loops are
constructed with zero trip guards so I assume one exists in those
cases. Tested with new test case, original failing program,
refworkload and full CTW.
I also improved a few debugging features. Node::find could get into
an infinite loop walking debug_orig, so it should be check for a
cycle. I made some other efficiency improvements before I realized
that the problem was a cycle. I went ahead and kept those changes.
IdealGraphPrinter should print out a few more debug fields and should
dump the block structure if it exists. I changed the printing after
beautify loops so it only happens once instead of after each recursive
call. I added an OSROnlyBCI flag to control which OSR bcis can be
compiled. I changed the assert in loop verification to allow verifying
when the igvn worklist isn't empty.
More information about the hotspot-compiler-dev