The OptViewer tool
oehrstroem at gmail.com
Wed Feb 27 17:48:41 PST 2013
I wrote the OptViewer tool for JRockit to help us improve the compiler.
The tool itself is written in Java and takes xml files with
data from the compilation/optimization process and
renders the data as web pages.
These web pages make it easy, entertaining and educational
to examine the compilation process. In particular since the
tool renders the differences at each step.
The xml data is output from the JVM and a new option is needed
in Hotspot: -XX:TraceCompilation=Test.test*
which means whenever any test method in Test is compiled,
output trace files into the directory TracedCompilations.
If you want to trace only test(I)J you write (I)J instead of *.
The C1 support is almost complete. (Unfortunately C1 does not
do many optimizations.) The C2 support is proof
of concept that it is possible to take the humongous C2-graph
and translate it into something human readable.
The webrev is here: http://cr.openjdk.java.net/~ohrstrom/ohrstrom/
Two generated examples are here:
(trivial test, its only reason to exist is that the C2 rendering works.)
(trivial autoboxing removal that JRockit handles well and soon C2
should do as well.)
mkdir -p TracedCompilations
rm -f TracedCompilations/*
java -XX:-TieredCompilation -Xcomp -XX:CompileOnly=Test.test
-XX:TraceCompilation=Test.test* -XX:+AlwaysIncrementalInline Test
java -client -Xcomp -XX:CompileOnly=Test.test
java -jar optviewer.jar TracedCompilations Test.test c1_1
java -jar optviewer.jar TracedCompilations Test.test c2_1
java -jar optviewer.jar TracedCompilations Test.test opt
More to come! Have fun!
More information about the hotspot-compiler-dev