I was going through a document which talks about just-in-time compiler (JIT) optimization techniques for Java. One of them was "loop inversion". And the document says:
You replace a regular
whileloop with ado-whileloop. And thedo-whileloop is set within anifclause. This replacement leads to two fewer jumps.
How does loop inversion work and how does it optimize our code path?
N.B.: It would be great if somebody can explain with an example of Java code and how JIT optimizes it to native code and why is it optimal in modern processors.