Title
Miniboxing: improving the speed to code size tradeoff in parametric polymorphism translations
Abstract
Parametric polymorphism enables code reuse and type safety. Underneath the uniform interface exposed to programmers, however, its low level implementation has to cope with inherently non-uniform data: value types of different sizes and semantics (bytes, integers, floating point numbers) and reference types (pointers to heap objects). On the Java Virtual Machine, parametric polymorphism is currently translated to bytecode using two competing approaches: homogeneous and heterogeneous. Homogeneous translation requires boxing, and thus introduces indirect access delays. Heterogeneous translation duplicates and adapts code for each value type individually, producing more bytecode. Therefore bytecode speed and size are at odds with each other. This paper proposes a novel translation that significantly reduces the bytecode size without affecting the execution speed. The key insight is that larger value types (such as integers) can hold smaller ones (such as bytes) thus reducing the duplication necessary in heterogeneous translations. In our implementation, on the Scala compiler, we encode all primitive value types in long integers. The resulting bytecode approaches the performance of monomorphic code, matches the performance of the heterogeneous translation and obtains speedups of up to 22x over the homogeneous translation, all with modest increases in size.
Year
DOI
Venue
2013
10.1145/2509136.2509537
OOPSLA
Keywords
Field
DocType
bytecode size,resulting bytecode,homogeneous translation,parametric polymorphism translation,heterogeneous translation,heterogeneous translation duplicate,size tradeoff,bytecode speed,novel translation,parametric polymorphism,value type,larger value type,generics,scala,data representation
Pointer (computer programming),Programming language,Reference type,Scala,Computer science,Parametric polymorphism,Theoretical computer science,Compiler,Value type,Bytecode,Type safety
Conference
Volume
Issue
ISSN
48
10
0362-1340
Citations 
PageRank 
References 
7
0.49
18
Authors
3
Name
Order
Citations
PageRank
Vlad Ureche11457.78
Cristian Talau270.49
Martin Odersky32261170.39