What is the size of methods that JIT automatically inlines?

HotSpot JIT inlining policy is rather complicated. It involves many heuristics like caller method size, callee method size, IR node count, inlining depth, invocation count, call site count, throw count, method signatures etc. Some limits are skipped for accessor methods (getters/setters) and for trivial methods (bytecode count less than 6). The related source code is … Read more

What are ReservedCodeCacheSize and InitialCodeCacheSize?

ReservedCodeCacheSize (and InitialCodeCacheSize) is an option for the (just-in-time) compiler of the Java Hotspot VM. Basically it sets the maximum size for the compiler’s code cache. The cache can become full, which results in warnings like the following: Java HotSpot(TM) 64-Bit Server VM warning: CodeCache is full. Compiler has been disabled. Java HotSpot(TM) 64-Bit Server … Read more

Does Java JIT cheat when running JDK code?

Yes, HotSpot JVM is kind of “cheating”, because it has a special version of some BigInteger methods that you won’t find in Java code. These methods are called JVM intrinsics. In particular, BigInteger.multiplyToLen is an intrinsic method in HotSpot. There is a special hand-coded assembly implementation in JVM source base, but only for x86-64 architecture. … Read more

Encourage the JVM to GC rather than grow the heap?

You could try specifying -XX:MinHeapFreeRatio and -XX:MaxHeapFreeRatio to control heap expansion and shrinking: -XX:MinHeapFreeRatio – when the percentage of free space in a generation falls below this value the generation will be expanded to meet this percentage. Default is 40. -XX:MaxHeapFreeRatio – when the percentage of free space in a generation exceeded this value the … Read more

Read Java JVM startup parameters (eg -Xmx)

Try: import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.util.List; public void runtimeParameters() { RuntimeMXBean bean = ManagementFactory.getRuntimeMXBean(); List<String> aList = bean.getInputArguments(); for (int i = 0; i < aList.size(); i++) { System.out.println( aList.get( i ) ); } } That should show all JVM parameters. Note: we do not have JVM parameter in VCS either, but in a … Read more

Difference between JVM and HotSpot?

The definition of what exactly is a Java Virtual Machine is stated in the Java Virtual Machine Specification The JVM is by definition a virtual machine, i.e. a software machine that simulates what a real machine does. Like a real machine, it has an instruction set, a virtual computer architecture and an execution model. It … Read more