garbage collection
Moazam Raja


The PrintCompilation flag and how to read its output

Rajiv Shivane has an excellent document on his site titled "Of Thread dumps and stack traces ...". After reading his document, I ventured into some of his other writings and found the following quote here:

"The only flag I could relate to here was the -XX:+PrintCompilation. It is another thing that I have no clue how to interpret the output of this flag either! I vaguely remember reading about this in some javaOne presentation. The presenter had mentioned that it prints the methods which could not be compiled and the user can list the methods which he doesn't want to be compiled in a .hotspot_compiler file. I really wish Sun had documented these flags and their output better, instead of just mentioning "traces methods as compiled" in the VM Options document." [Rajiv Shivane - Of perf degradation with try-finallies and poor VM option docs]

Rajiv, [insert presidential voice] I feel your pain. I really do. I'm working on a document right now which will list out many JVM options and which versions (1.2.2, 1.3.1, etc.) these options are applicable to or not.

But nevertheless, lets get back to the meat of the matter, the question on -XX:+PrintCompilation. I thought that a more detailed explanation of this flags output existed somewhere on the public internet, but maybe I just can't find it today. So I'll make a small attempt to explain the output.

The -XX:+PrintCompilation flag output looks something like this:

1 sbjava.lang.ClassLoader::loadClassInternal (6 bytes)
2 bjava.lang.String::lastIndexOf (12 bytes)
3 s!bjava.lang.ClassLoader::loadClass (58 bytes)

Flags correspond to:

b Blocking compiler (always set for client)
* Generating a native wrapper
% On stack replacement
! Method has exception handlers
sSynchronized method

As Rajiv points on, once you find the offending method, you can tell the JVM to bypass it by creating a .hotspot_compiler file in your current working directory with an exclude statement. For example,

exclude java/lang/String indexOf

This would stop the java.lang.String.indexOf() method from being compiled.

Click here to visit the Radio UserLand website.
Click to see the XML version of this web page.
Click here to send an email to the editor of this weblog.
© Copyright 2004 Moazam Raja.
Last update: 6/20/2004; 4:53:33 PM.