Abstract
While many object-oriented languages impose space overhead of only one word per object to support features like virtual method dispatch, Java’s richer functionality has led to implementations that require two or three header words per object. This space overhead increases memory usage and attendant garbage collection costs, reduces cache locality, and constrains programmers who might naturally solve a problem by using large numbers of small objects.
In this paper, we show that with careful engineering, a high-performance virtual machine can instantiate most Java objects with only a single-word object header. The single header word provides fast access to the virtual method table, allowing for quick method invocation. The implementation represents other per-object data (lock state, hash code, and garbage collection flags) using heuristic compression techniques. The heuristic retains two-word headers, containing thin lock state, only for objects that have synchronized methods.
We describe the implementation of various object models in the IBM Jikes Research Virtual Machine, by introducing a pluggable object model abstraction into the virtual machine implementation. We compare an object model with a two-word header with three different object models with single-word headers. Experimental results show that the object header compression techniques give a mean space savings of 7%, with savings of up to 21%. Compared to the two-word headers, the compressed space-encodings result in application speedups ranging from −1.5% to +2.2%. Performance on synthetic micro-benchmarks ranges from +23% due to benefits from reduced object size, to −12% on a stress test of virtual method invocation.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Agesen, O., Detlefs, D., Garthwaite, A., Knippel, R., Ramakrishna, Y. S., AND White, D. An efficient meta-lock for implementing ubiquitous synchronization. In OOPSLA’99 Conference Proceedings: Object-Oriented Programming Systems, Languages, and Applications (Denver, Colorado, Oct. 1999). SIGPLAN Notices, 34, 10, 207–222.
Aldrich, J., Chambers, C., Sirer, E. G., AND Eggers, S. J. Static analyses for eliminating unnecessary synchronization from Java programs. In Static Analysis: Sixth International Symposium (Venice, Italy, Sept. 1999), A. Cortesi and G. Filé, Eds., vol. 1694 of Lecture Notes in Computer Science, Springer Verlag, pp. 19–38.
Aldrich, J., Sirer, E. G., Chambers, C., AND Eggers, S. Comprehensive synchronization elimination for Java. Tech. Rep. UW-CSE-00-10-01, Department of Computer Science, University of Washington, 2000.
Alpern, B., Cocchi, A., Fink, S., Grove, D., AND Lieber, D. Efficient implementation of Java interfaces: invokeinterface considered harmless. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications (Tampa, Florida, Oct. 2001). SIGPLAN Notices, 36, 10, 108–124.
Alpern, B., Cocchi, A., AND Grove, D. Dynamic type checking in Jalapeño. In Proceedings of the Java Virtual Machine Research and Technology Symposium (Monterey, California, Apr. 2001), pp. 41–52.
Alpern, B., et al. The Jalapeño virtual machine. IBM Syst. J. 39, 1 (2000), 211–238.
Bacon, D. F., Konuru, R., Murthy, C., AND Serrano, M. Thin locks: Featherweight synchronization for Java. In Proceedings of the SIGPLAN Conference on Programming Language Design and Implementation (Montreal, Canada, June 1998). SIGPLAN Notices, 33, 6, 258–268.
Bogda, J., AND Hölzle, U. Removing unnecessary synchronization in Java. In Conference Proceedings: Object-Oriented Programming Systems, Languages, and Applications (Denver, Colorado, Oct. 1999). SIGPLAN Notices, 34, 10, 35–46.
Detlefs, D., AND Agesen, O. Inlining of virtual methods. In Thirteenth European Conference on Object-Oriented Programming (1999), vol. 1628 of Lecture Notes in Computer Science, Springer Verlag, pp. 258–278.
Dieckmann, S., AND Hölzle, U. A study of the allocation behavior of the SPECjvm98 Java benchmarks. In Proceedings of the Thirteenth European Conference on Object-Oriented Programming (Lisbon, Portugal, 1999), R. Guerraoui, Ed., vol. 1628 of Lecture Notes in Computer Science, Springer-Verlag, pp. 92–115.
Dybvig, R. K., Eby, D., AND Bruggeman, C. Don’t stop the BIBOP: Flexible and efficient storage management for dynamically-typed languages. Tech. Rep. 400, Indiana University Computer Science Department, 1994.
Fitzgerald, R. P., Knoblock, T. B., Ruf, E., Steensgaard, B., AND Tarditi, D. Marmot: an optimizing compiler for Java. Software-Practice and Experience 30, 3 (2000), 199–232.
Gagnon, E., AND Hendren, L. Sable VM: A research framework for the efficient execution of Java bytecode. In Proceedings of the Java Virtual Machine Research and Technology Symposium (Monterey, California, Apr. 2001), pp. 27–40.
Ishizaki, K., Kawahito, M., Yasue, T., Komatsu, H., AND Nakatani, T. A study of devirtualization techniques for a Java Just-In-Time compiler. In OOPSA’2000 Conference Proceedings: Object-Oriented Programming Systems, Languages, and Applications (Tampa, Florida, Oct. 2000). SIGPLAN Notices, 35, 10, 294–310.
Jikes RVM 2.0.4. http://www.ibm.com/developerworks/oss/jikesrvm.
Jones, R. E., AND Lins, R. D.Garbage Collection. John Wiley and Sons, 1996.
Krall, A., AND Probst, M. Monitors and exceptions: how to implement Java efficiently. Concurrency: Practice and Experience 10, 11-13 (1998), 837–850.
Krall, A., AND Tomsich, P. Java for large-scale scientific computations? In Proceedings of the Third International Conference on Large-Scale Scientific Computing (Sozopol, Bulgaria, June 2001), S. Margenov, J. Wasniewski, and P. Y. Yalamov, Eds., vol. 2179 of Lecture Notes in Computer Science, Springer Verlag, pp. 228–235.
Myers, A. C. Bidirectional object layout for separate compilation. In OOPSLA’95 Conference Proceedings: Object-Oriented Programming Systems, Languages, and Applications (Oct. 1995). SIGPLAN Notices, 30, 10, 124–139.
Onodera, T., AND Kawachiya, K. A study of locking objects with bimodal fields. In OOPSLA’99 Conference Proceedings: Object-Oriented Programming Systems, Languages, and Applications (Denver, Colorado, Oct. 1999). SIGPLAN Notices, 34, 10, 223–237.
Ruf, E. Effective synchronization removal for Java. In Proceedings of the SIGPLAN Conference on Programming Language Design and Implementation (Vancouver, British Columbia, June 2000). SIGPLAN Notices, 35, 5, 208–218.
Shuf, Y., Gupta, M., Bordawekar, R., AND Singh, J. P. Exploiting prolific types for memory management and optimizations. In Conference Record of the ACM Conference on Principles of Programming Languages (Portland, Oregon, Jan. 2002), pp. 295–306.
Stroustroup, B.The Annotated C++ Reference Manual. Addison-Wesley, 1990. Chapter 10, section 10.
Sweeney, P. F., AND Tip, F. A study of dead data members in C++ applications. In Proceedings of the SIGPLAN Conference on Programming Language Design and Implementation (Montreal, Canada, June 1998). SIGPLAN Notices, 33, 6, 324–332.
The Standard Performance Evaluation Corporation. SPEC JVM98 Benchmarks. http://www.spec.org/osg/jvm98, 1998.
The Standard Performance Evaluation Corporation. SPEC JBB 2000 Benchmark. http://www.spec.org/osg/jbb2000, 2000.
Tip, F., AND Sweeney, P. F. Class hierarchy specialization. In OOPSLA’97 Conference Proceedings: Object-Oriented Programming Systems, Languages, and Applications (Denver, Colorado, Oct. 1997). SIGPLAN Notices, 32, 10, 271–285.
Yang, B.-S., Lee, J., Park, J., Moon, S.-M., AND Ebcioğlu, K. Lightweight monitor in Java virtual machine. In Proceedings of the Third Workshop on Interaction between Compilers and Computer Architectures (San Jose, California, Oct. 1998). SIGARCH Computer Architecture News, 21, 1, 35–38.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Bacon, D.F., Fink, S.J., Grove, D. (2002). Space- and Time-Efficient Implementation of the Java Object Model. In: Magnusson, B. (eds) ECOOP 2002 — Object-Oriented Programming. ECOOP 2002. Lecture Notes in Computer Science, vol 2374. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-47993-7_5
Download citation
DOI: https://doi.org/10.1007/3-540-47993-7_5
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-43759-8
Online ISBN: 978-3-540-47993-2
eBook Packages: Springer Book Archive