Abstract
Language implementations that use a uniform pointer representation for generic datatypes typically apply boxing operations to convert non-uniform objects into the required form. The cost of this boxing process impacts upon the performance of programs that make heavy use of genericity with non-uniform data such as integers and other primitive value types. We show that the overhead of boxing objects into heap storage can be significantly reduced by taking a lazy approach: allowing pointers to stack-allocated objects that are only copied to the heap when necessary. Delaying the boxing of objects avoids unnecessary heap allocation, and results in speedups of around 25% for a range of test programs.
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
Hejlsberg, A., Wiltamuth, S.: C# language reference. Microsoft Developer Network Library (2000)
Bracha, G., Odersky, M., Stoutamire, D., Wadler, P.: Making the future safe for the past: Adding genericity to the Java programming language. In: Proceedings of OOPSLA 1998. SIGPLAN Notices, vol. 33(10), pp. 183–200. ACM, New York (1998)
Cartwright, R., Steele, G.: Compatible genericity with run-time types for the Java programming language. In: Proceedings of OOPSLA 1998. SIGPLAN Notices, vol. 33(10), pp. 201–215. ACM, New York (1998)
Odersky, M., Wadler, P.: Pizza into Java: Translating theory into practice. In: Proceedings of POPL 1997, ACM Symposium, Paris, France, pp. 146–159 (1997)
Kennedy, A., Syme, D.: Design and implementation of generics for the .NET Common Language Runtime. In: Proceedings of PLDI 2001, ACM Conference. SIGPLAN Notices, vol. 36(5), pp. 1–12 (2001)
Stroustrup, B.: The Design and Evolution of C++. Addison-Wesley, Reading (1994)
Collin, S., Colnet, D., Zendra, O.: Type inference for late binding: The SmallEiffel compiler. In: Mössenböck, H. (ed.) JMLC 1997. LNCS, vol. 1204, pp. 67–81. Springer, Heidelberg (1997)
Leroy, X.: Unboxed objects and polymorphic typing. In: Proceedings of POPL 1992, ACM Symposium, Albequerque, New Mexico, pp. 177–188 (1992)
Shao, Z., Appel, A.W.: A type-based compiler for Standard ML. In: Proceedings of PLDI 1995, ACM Conference. SIGPLAN Notices, vol. 30(6), pp. 116–129 (1995)
Harper, R., Morrisett, G.: Compiling polymorphism using intensional type analysis. In: Proceedings of POPL 1995, ACM Symposium, San Francisco, California, pp. 130–141 (1995)
Shao, Z.: An overview of the FLINT/ML compiler. In: Workshop on Types in Compilation, TIC 1997 (1997)
Tarditi, D., Morrisett, G., Cheng, P., Stone, C., Harper, R., Lee, P.: TIL: A typedirected optimizing compiler for ML. In: Proceedings of PLDI 1996, ACM Conference. SIGPLAN Notices, vol. 31(5), pp. 181–192 (1996)
Choi, J.D., Gupta, M., Serrano, M., Sreedhar, V.C., Midkiff, S.: Escape analysis for Java. ACM SIGPLAN Notices 34, 1–19 (1999)
Gay, D., Steensgaard, B.: Fast escape analysis and stack allocation for object-based programs. In: Watt, D.A. (ed.) CC 2000. LNCS, vol. 1781, p. 82. Springer, Heidelberg (2000)
Owen, T.: A Type-Passing Implementation of Value Types and Genericity. PhD thesis, University of Sussex, Brighton, UK (2002), Available at http://www.cogs.susx.ac.uk/users/timo/thesis.pdf
Meyer, B.: Eiffel: The Language. Prentice-Hall, Englewood Cliffs (1992)
Boehm, H.J.: Space efficient conservative garbage collection. ACM SIGPLAN Notices 28, 197–206 (1993)
Peyton Jones, S.L., Nordin, T., Oliva, D.: C–: A portable assembly language. In: Clack, C., Hammond, K., Davie, T. (eds.) IFL 1997. LNCS, vol. 1467, p. 1. Springer, Heidelberg (1998)
Gordon, A., Syme, D.: Typing a multi-language intermediate code. In: Proceedings of POPL 2001, ACM Symposium, London, England, pp. 248–260 (2001)
Meyers, S.: More Effective C++. Addison-Wesley, Reading (1996)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Owen, T., Watson, D. (2004). Reducing the Cost of Object Boxing. In: Duesterwald, E. (eds) Compiler Construction. CC 2004. Lecture Notes in Computer Science, vol 2985. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-24723-4_14
Download citation
DOI: https://doi.org/10.1007/978-3-540-24723-4_14
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-21297-3
Online ISBN: 978-3-540-24723-4
eBook Packages: Springer Book Archive