Infinite
Infinite

Reputation: 3408

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?

Upvotes: 7

Views: 3850

Answers (2)

Robin Green
Robin Green

Reputation: 33033

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

Upvotes: 3

DaoWen
DaoWen

Reputation: 33019

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).

Upvotes: 5

Related Questions