Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable inlining optimization with sun jvm?

I need to do some experiments showing the effect of inlining on my code. Anybody knows how to disable inlining with sun jvm? I searched http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html and got to know -XX:InlineSmallCode=n can control the threshold of the inlining candidates. So will -xx:InlineSmallCode=0 work?

like image 503
Infinite Avatar asked Mar 10 '13 23:03

Infinite


2 Answers

I would try -XX:MaxInlineSize=0 instead. The description for InlineSmallCode seems a bit unclear as to whether or not it applies to all inlinings. You might also find this blog post helpful as it explains how to tell the JIT compiler to print information about which methods are being inlined:

Java 7: How to write really fast Java code

I think there might still be one exception where you can't disable inlining, and that's for completely empty methods (since the inlined method size would still be 0).

like image 185
DaoWen Avatar answered Oct 03 '22 02:10

DaoWen


In Java 8, you can do it by passing the option -XX:-Inline to the JVM.

like image 45
Robin Green Avatar answered Oct 03 '22 01:10

Robin Green