Filtering the output of -XX:+PrintAssembly

Christian Thalinger Christian.Thalinger at Sun.COM
Tue Nov 17 08:59:05 PST 2009


On Tue, 2009-11-17 at 10:52 -0600, Dennis Byrne wrote:
> Thanks for your reply Christian.  Unfortunately I get nothing when I
> omit -XX:+PrintAssembly
> 
> dbyrne at wud-nbyrne01:~/print_assembly/java$ javac HelloWorld.java
> dbyrne at wud-nbyrne01:~/print_assembly/java$
> /usr/lib/jvm/java-6-openjdk/jre/bin/java
> -XX:+UnlockDiagnosticVMOptions
> -XX:PrintAssemblyOptions=hsdis-print-bytes -Xbatch
> -XX:CompileCommand=print,*HelloWorld.main HelloWorld
> CompilerOracle: print *HelloWorld.main
> 3331
> 
> Here is the source code if it helps.
> 
> class HelloWorld{
>   private static int i = 1;
>   private static int j = 22;
> 
>   public static void main(String[] args){
>      for(int j = 0; j < 10; j++){
>          i += 333;
>      }
>      System.out.println(i);
>   }
> }

The reason you don't get any output is because your main method doesn't
get compiled.  The loop is to short to trigger a compile.  You can use
-XX:+PrintCompilation to see what methods get compiled.

-- Christian



More information about the hotspot-dev mailing list