The ChipList, by Adrian Offerman; The Processor Portal

new
Processor Selector

Platform:
Segment:
View: show / edit

bookmark bookmark site
bookmark permalink

Inlining Information Hidden in the Hotspot JVM


Inlining Information Hidden in the Hotspot JVM

When troubleshooting a performance problem, we often want to know what part of a program's source code caused the problem in the first place. Luckily, in the case of Java source, there are numerous tools that simplify this process by displaying the compiled code and source code for a method side-by-side. These Java analysis tools rely on the Java Virtual Machine Tools Interface (JVMTI) to capture information about how a program's source code maps to the compiled code.
 
 
One limitation of JVMTI is that when a method is compiled, the methods that it calls may be inlined into its own body.
For example, consider the following code snippet:
 
int foo(int j)
{
 
return j+1;
 
}
 
public static void main(String[] args)
{
   for(int i = 0; i < 3; i++)
   {
       j += foo(j);
    }
}
 
The JVM is smart enough to see that the work being done inside the function foo is trivial (the incrementing of a counter), and that it would be less expensive to execute the code for foo as part of the code for main than to execute a separate procedure call to foo.  As a result, the JVM ...

ChipList news channel Last Months News


ChipList developers news channel Last Months Developers News


Page viewed 614 times since Tue 13 Jan 2009, 0:40.