Computer Science · Hardware and Architecture
A Survey of Optimisations for the Java Virtual Machine (Extended Abstract)
See on the mapAbstract
The Java Virtual Machine (JVM) is often realised with an interpreter or just in time (JIT) compiler. JITs easily outperform interpreters, however a large portion of the compiler must be re-engineered for each architecture it is ported to. Interpreters are far easier to develop and to maintain and are much more portable. The weakness of interpreters is that they are much slower than JITs. This survey describes the work in progress on faster Java Interpreters and the new optimisations that are being developed for modern computer architectures to improve Interpreter performance. 1. INTERPRETATION TECHNIQUES In Interpretation Techniques [7] the relative merits of implementing high level languages by means of interpretation or compilation are discussed. Also the properties and applicability of interpretation techniques known as classical interpretation, direct threading and indirect threaded code are described and compared. The interpretation of a virtual machine instruction is comprised of accessing the arguments of the instruction, implementing the function of the instruction and dispatching ( fetching, decoding and starting) the next instruction. Classical interpretation is often implemented via a giant switch approach. Operations must be looked up in a table in order to identify the address of the corresponding native subroutine. Direct Threading encodes operations as addresses of the corresponding subroutine. This eliminates the need for a lookup table. It is easy to add new opcodes for specific operations that a specific program may need. In addition direct threading eliminates the dispatch overhead consistent with classical interpretation. Indirect threaded code consists of another level of indirection. Operations are encoded as pointers to locations that hold the actual address. In addition frequently used constant values are added to the addresses of a reoccurring subroutine such as fetch, store and call. Indirect threading accommodates operators that depend on operand type. One need only generate a