OpenJDK Hacking Workshop -- Insructions Participants will need an x86 machine running some version of Linux (virtualized should be ok). fedora 17/18/19 is recommended. Other Linuxes will probably work so long as you are happy and willing to install missing packages or upgrade package versions as determined by the configure script. See the download instructions for help on obtaining the OpenJDK source code forest. See the build instructions for help bulding OpenJDK forest. Step 1: Run your OpenJDK build from the command line 1) Move to the location where you downloadeded the code $ cd 2) run javac on Hello.java (you will need to write Hello.java) $ ./build/linux-x86_64-normal-server-slowdebug/images/j2sdk-image/bin/javac Hello.java 3) run Hello $ ./build/linux-x86_64-normal-server-slowdebug/images/j2sdk-image/bin/java Hello Step 2: Now try running with some of the debug/trace options available in runtime/globals.hpp enabled Watch as the JDK calls out to JVM_ENTRY functions -XX:+TraceJVMCalls Watch as the JVM calls out to runtime support functions -XX:+TraceRuntimeCalls Dump the generated templates used by th etemplate interpreter -XX:+PrintInterpreter Show what the compiler is doing: -- print each compile request queued to the compiler -XX:+CIPrintRequests -- print details of each method compile -XX:+PrintCompilation -- trace installation of each compiled method -XX:TraceNMethodInstalls hmm, this one can get quite verbose unless you use it with CompileOnly (see below) Print disassembly of compiled methods -XX:+PrintNMethods limit what gets compiled -Xcomp -XX:+PrintCompilation -XX:CompileOnly="Hello.main" limit compilation and dump the compiled code -Xcomp -XX:+PrintCompilation -XX:CompileCommand=compileonly,"Hello.main" -Xcomp -XX:+PrintCompilation -XX:CompileCommand=compileonly,"Hello.main" -XX:CompileCommand=print,"Hello.main" specify multiple commands via a command file cat > commands << EOF compileonly Hello.main print Hello.main compileonly java/lang/String.hashCode print java/lang/String.hashCode EOF -Xcomp -XX:+PrintCompilation -XX:CompileCommandFile=commands disable tiered compilation -XX:-TieredCompilation (default is yes) (if you want to up the detail for a trace/print option) -XX:+Verbose for even more detail -XX:+WizardMode Step 5 Now run in gdb (best is within emacs!) $ gdb ./build/linux-x86_64-normal-server-slowdebug/images/j2sdk-image/bin/java (gdb) break TemplateInterpreter::initialize . . . (gdb) run Hello