Java JIT loop unrolling policy?

后端 未结 2 1324
误落风尘
误落风尘 2021-01-17 19:14

What is the loop unrolling policy for JIT? Or if there is no simple answer to that, then is there some way i can check where/when loop unrolling is being performed in a loop

2条回答
  •  别那么骄傲
    2021-01-17 19:51

    If the JVM unrolls the loop is probably best answered by actually printing the generated assembly. Note that this requires your code to actually be executed as a hot spot (i.e. the JVM considers it worthy of the expensive optimizations).

    Why the JVM decides one way or another is a much harder question and probably requires in-depth analysis of the JIT code.

提交回复
热议问题