Browse Prior Art Database

Debugging JITted Java Code

IP.com Disclosure Number: IPCOM000123736D
Original Publication Date: 1999-Apr-01
Included in the Prior Art Database: 2005-Apr-05
Document File: 4 page(s) / 155K

Publishing Venue

IBM

Related People

Hilpert Jr, EJ: AUTHOR [+2]

Abstract

In normal operation in Java, the Java compiler processes Java instructions and generates a .class file which contains byte codes that are interpreted by the Java Virtual Machine when executing any of the methods in that class. But executing interpreted code is considerably slower than executing compiled, or native, code. To solve this problem, the current state of the art in Java Virtual Machine (JVM) technology provides a JIT (Just-In-Time) compiler that translates Java byte codes into native, platform-specific, machine (assembly) code that is executed directly by the client CPU, not interpreted by the JVM.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 29% of the total text.

Debugging JITted Java Code

   In normal operation in Java, the Java compiler processes
Java instructions and generates a .class file which contains byte
codes that are interpreted by the Java Virtual Machine when
executing any of the methods in that class.  But executing
interpreted code is considerably slower than executing compiled, or
native, code.  To solve this problem, the current state of the art in
Java Virtual Machine (JVM) technology provides a JIT (Just-In-Time)
compiler that translates Java byte codes into native,
platform-specific, machine (assembly) code that is executed directly
by the client CPU, not interpreted by the JVM.

   To get to JITted code, two steps must take place.  First,
the Java instructions (source code in a .java file) need to be
compiled by the Java compiler into Java byte codes (and stored in a
.class file).  The byte codes are loaded when the .class file is
loaded by the Java Virtual Machine's class loader.  Then when a
determination is made that a specific method is to be JITted, the
JIT uses the byte codes of the method to create native code
(jitcode) to be run when that method is called.  Here is an
illustration of the process:
           Java Compiler             JIT
                 |                    |
   JavaInstruction ------>  bytecode ------>jitcode
                                            jitcode
                            bytecode ------>jitcode
                                            jitcode
                                            jitcode
                                            jitcode
                            bytecode ------>jitcode
                                            jitcode
                                            jitcode
   JavaInstruction ------>  bytecode ------>jitcode
   and so on

   Internal to the class file, the line numbers to the Java
source instructions are correlated to Java byte codes so that a
debugger (or other tool) can follow the execution path as the Java
program counter is incremented through the Java byte codes,
correlating the Java source line being executed (one Java
instruction can generate one or more Java byte codes that are
interpreted by the JVM to execute the Java applet or application).
It is with this mechanism that a Java debugger can display the
current Java instruction (or Java bytecode) being executed when
execution is stopped by a fault, breakpoint, or other execution
stoppage, or when stepping through individual instructions.

   The act of "JITting" code creates a new and very different
machine representation of the method code.  The data st...