Compilation to bytecode paired with interpretation is often used as a technique to easily build prototypes for new programming languages. Some languages, including Java, push this further and use the bytecode layer to isolate programs from the underlying platform. Current state-of-the-art commercial and research Java virtual machines implement advanced just-in-time and adaptive compilation techniques to deliver high-performance execution of Java bytecode. Yet, experimenting with new features such as adding new bytecodes or redesigning the type system can be a daunting task within these complex systems, when new features invalidate assumptions on which the internal dynamic optimizing compiler depends. On the other hand, simpler existing Java bytecode interpreters, written purely in high-level languages, deliver poor performance. The main motivation behind this thesis was to answer the question: How fast can a portable, easily modifiable Java bytecode interpreter be? In order to address this question, we have designed and developed the Sable VM research framework, a portable interpreter-based Java virtual machine written in portable C. In this thesis we introduce innovative techniques for implementing an efficient, yet portable Java bytecode interpreter. These techniques address three areas: instruction dispatch, memory management, and synchronization. Specifically, we show how to implement an inline-threaded engine in the presence of lazy code preparation, without incurring a high synchronization penalty. We then introduce a logical partitioning of runtime system memory that simplifies memory management, and a related sparse interface virtual table design for fast interface-method invocation. We show how to efficiently compute space-efficient garbage collection maps for verifiable bytecode. We also present a bidirectional object layout that simplifies garbage collection. Finally, we introduce an improvement to thin locks, eliminating busy-wait in case of contention. Our experiments within the Sable VM framework show that inline-threading [PR98] Java delivers significant performance improvement over switch and direct-threading, that sparse interface tables cause no memory loss, and that our map computation algorithm delivers a very small number of distinct garbage collection maps. Our overall performance measurements show that, using our techniques, a portable interpreter can deliver competitive interpretation performance, and even surpass that of a less-portable state-of-the-art interpreter on some benchmarks.
Cited By
- Garner R, Blackburn S and Frampton D (2011). A comprehensive evaluation of object scanning techniques, ACM SIGPLAN Notices, 46:11, (33-42), Online publication date: 18-Nov-2011.
- Garner R, Blackburn S and Frampton D A comprehensive evaluation of object scanning techniques Proceedings of the international symposium on Memory management, (33-42)
- Lambert J and Power J (2008). Platform Independent Timing of Java Virtual Machine Bytecode Instructions, Electronic Notes in Theoretical Computer Science (ENTCS), 220:3, (97-113), Online publication date: 1-Dec-2008.
- Prokopski G and Verbrugge C (2008). Analyzing the performance of code-copying virtual machines, ACM SIGPLAN Notices, 43:10, (403-422), Online publication date: 27-Oct-2008.
- Prokopski G and Verbrugge C Analyzing the performance of code-copying virtual machines Proceedings of the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applications, (403-422)
- Prokopski G and Verbrugge C Compiler-guaranteed safety in code-copying virtual machines Proceedings of the Joint European Conferences on Theory and Practice of Software 17th international conference on Compiler construction, (163-177)
- Casey K, Ertl M and Gregg D (2007). Optimizing indirect branch prediction accuracy in virtual machine interpreters, ACM Transactions on Programming Languages and Systems (TOPLAS), 29:6, (37-es), Online publication date: 1-Oct-2007.
- Kågström S, Grahn H and Lundberg L Cibyl Proceedings of the 3rd international conference on Virtual execution environments, (75-82)
- Xu H, Pickett C and Verbrugge C Dynamic purity analysis for java programs Proceedings of the 7th ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineering, (75-82)
- Agosta G, Reghizzi S and Svelto G Jelatine Proceedings of the 4th international workshop on Java technologies for real-time and embedded systems, (170-177)
- Vertanen O Java type confusion and fault attacks Proceedings of the Third international conference on Fault Diagnosis and Tolerance in Cryptography, (237-251)
- Gu D, Verbrugge C and Gagnon E Relative factors in performance analysis of Java virtual machines Proceedings of the 2nd international conference on Virtual execution environments, (111-121)
- Pickett C and Verbrugge C (2005). SableSpMT, ACM SIGSOFT Software Engineering Notes, 31:1, (59-66), Online publication date: 1-Jan-2006.
- Pickett C and Verbrugge C Software thread level speculation for the java language and virtual machine environment Proceedings of the 18th international conference on Languages and Compilers for Parallel Computing, (304-318)
- Pickett C and Verbrugge C SableSpMT Proceedings of the 6th ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineering, (59-66)
- von Ronne J, Wang N and Franz M Interpreting programs in static single assignment form Proceedings of the 2004 workshop on Interpreters, virtual machines and emulators, (23-30)
- Davis B, Beatty A, Casey K, Gregg D and Waldron J The case for virtual register machines Proceedings of the 2003 workshop on Interpreters, virtual machines and emulators, (41-49)
- Berndl M and Hendren L Dynamic profiling and trace cache generation Proceedings of the international symposium on Code generation and optimization: feedback-directed and runtime optimization, (276-285)
Index Terms
- A portable research framework for the execution of java bytecode
Recommendations
Decompiling Java Bytecode: Problems, Traps and Pitfalls
CC '02: Proceedings of the 11th International Conference on Compiler ConstructionJava virtual machines execute Java bytecode instructions. Since this bytecode is a higher level representation than traditional object code, it is possible to decompile it back to Java source. Many such decompilers have been developed and the ...
Soot - a Java bytecode optimization framework
CASCON '99: Proceedings of the 1999 conference of the Centre for Advanced Studies on Collaborative researchThis paper presents Soot, a framework for optimizing Java bytecode. The framework is implemented in Java and supports three intermediate representations for representing Java bytecode: Baf, a streamlined representation of bytecode which is simple to ...
A Portable CPU-Management Framework for Java
The Java Resource Accounting Framework, second edition (J-RAF2), is a portable CPU-management framework for Java environments. It is based on fully automated program-transformation techniques applied at the bytecode level and can be used with every ...