Article thumbnail

Effects of Static Type Specialization on Java Generic Collections (Technical Report) UMM Working Papers Series Work in progress

By Elena Machkasova, Elijah Mayfield, Nathan Dahlberg and J. Kyle Roth

Abstract

Abstract. Generic types in the Java programming language provide the convenience of writing generic code and perform compilation-time type checking. However, the implementation based on type erasure discards type instance information before run time, complicating dynamic optimizations. We propose a specialization of generic types- a sourceto-source transformation that creates specialized copies of a subset of generic classes, replacing their type bounds with specific instance types. Making instance type information available at run time removes unnecessary typecasting and enables the JVM to perform optimizations, such as method inlining. However, interactions of type specialization with the JVM are complex. Specializing more classes may introduce inefficiencies due to extra typechecks, array operations, or JVM warmup. We study trade-offs between effects of type specialization and suggest criteria for selecting groups of classes for performance improvements. As an example, we compare different ways of specializing subsets of the Java collections library and present an algorithm for specializing such classes. Both the client and the server modes of Sun’s HotSpot JVM are studied. We show that generic type specialization enables a program speed up of up-to 20 % by specializing only a few classes.

Year: 2008
OAI identifier: oai:CiteSeerX.psu:10.1.1.211.5990
Provided by: CiteSeerX
Download PDF:
Sorry, we are unable to provide the full text but you may find it at the following location(s):
  • http://citeseerx.ist.psu.edu/v... (external link)
  • http://cda.mrs.umn.edu/~elenam... (external link)
  • Suggested articles


    To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.