Profile Image
vishnupriya

What is JVM startup parameter: -XX:InlineSmallCode?

What is JVM startup parameter: -XX:InlineSmallCode? Have you used this JVM arguement before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvmargument

  • xx-inlinesmallcode

  • x-inlinesmallcode

  • JVM startup parameter

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:

 

This option allows the JVM to inline only already compiled methods if their code size is below the maximum size provided after the argument, only smaller ones will be inlined. It syntax is the following: -XX:InlineSmallCode=value, where value is the size in bytes.

 

Since:

 

Starting from JDK 6.

 

Examples:

 

To set a maximum code size to 2048 bytes:

 

java -XX:InlineSmallCode=2048 MainClass

 

Description:

 

Inlining is a way to optimize compiled source code at runtime by replacing the invocations of the most often executed methods with its bodies.

 

Although there's compilation involved, it's not performed by the traditional javac compiler, but by the JVM itself. To be more precise, it's the responsibility of the Just-In-Time (JIT) compiler, which is a part of the JVM; javac only produces a bytecode and lets JIT do the magic and optimize the source code.

 

One of the most important consequences of this approach is that if we compile the code using old Java, the same .class file will be faster on newer JVMs. This way we don’t need to recompile the source code, but only update Java.

 

The option “InlineSmallCode” which prevent inlining except for very small code blocks which can’t exceed the maximum size given as the value of the argument.

 

You can also specify a data unit such as “k” or “K” for kilobytes, “m” or “M” for Megabytes and “g” or “G” for Gigabytes.

 

  • For using 512 Kilobytes: -XX:InlineSmallCode=512k
  • For using 128 Megabytes: -XX:InlineSmallCode=128m
  • For using 12 Gigabytes: -XX:InlineSmallCode=12g

 

Default Value:

 

The default value is 1000 bytes.

 

Arguments related:

 

Inline, FreqInlineSize and MaxInlineSize

 

Related Posts:

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvmargument

  • xx-inlinesmallcode

  • x-inlinesmallcode

  • JVM startup parameter