Type-safe method inlining

  • Authors:
  • Neal Glew;Jens Palsberg

  • Affiliations:
  • Intel Corporation, Santa Clara, CA;UCLA Computer Science Department, 4531K Boelter Hall, Los Angeles, CA

  • Venue:
  • Science of Computer Programming - Special issue on program transformation
  • Year:
  • 2004

Quantified Score

Hi-index 0.00

Visualization

Abstract

In a typed language such as Java, inlining of virtual methods does not always preserve typability. The best known solution to this problem is to insert type casts, which may hurt performance. This paper presents a solution that never hurts performance. The solution is based on a transformation that modifies static type annotations and changes some virtual calls into static calls, which can then be safely inlined. The transformation is parametrised by a flow analysis, and for any analysis that satisfies certain conditions, the transformation is correct and idempotent. The paper presents the transformation, the conditions on the flow analysis, and proves the correctness properties in the context of a variant of Featherweight Java.