Affiliation:
1. EPFL, Lausanne, Switzerland
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.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Reference42 articles.
1. Ceylon Programming Language. URL http://ceylon-lang.org/. Ceylon Programming Language. URL http://ceylon-lang.org/.
2. Kotlin Programming Language. URL http://kotlin.jetbrains.org/. Kotlin Programming Language. URL http://kotlin.jetbrains.org/.
3. Scala Programming Language. URL http://scala-lang.org/. Scala Programming Language. URL http://scala-lang.org/.
4. X10 Programming Language. URL http://x10-lang.org/. X10 Programming Language. URL http://x10-lang.org/.
Cited by
3 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献