Inlining of Virtual Methods

We discuss aspects of inlining of virtual method invocations. First, we introduce a new method test to guard inlinings of such invocations, with a different set of tradeoffs from the class-equality tests proposed previously in the literature. Second, we consider the problem of inlining virtual methods directly, with no guarding test, in dynamic languages such as Self or the Java™ programming language, whose semantics prohibit a static identification of the complete set of modules that comprise a program. In non-dynamic languages, a whole-program analysis might prove the correctness of a direct virtual inlining. In dynamic languages, however, such analyses can be invalidated by later class loading, and must therefore be treated as assumptions whose later violation must cause recompilation. In the past, such systems have required an on-stack replacement mechanism to update currently-executing invocations of methods containing invalidated inlinings. This paper presents analyses that allow some virtual calls to be inlined directly, while ensuring that invocations in progress may complete safely even if class loading invalidates the inlining for future invocations. This provides the benefits of direct inlining without the need for on-stack replacement, which can be complicated and require space-consuming data structures.

[1]  David Grove,et al.  Selective specialization for object-oriented languages , 1995, PLDI '95.

[2]  Karel Driesen,et al.  Accurate indirect branch prediction , 1998, ISCA.

[3]  ChambersCraig,et al.  Selective specialization for object-oriented languages , 1995 .

[4]  David Grove,et al.  Call graph construction in object-oriented languages , 1997, OOPSLA '97.

[5]  L. Peter Deutsch,et al.  Efficient implementation of the smalltalk-80 system , 1984, POPL.

[6]  David Grove,et al.  Vortex: an optimizing compiler for object-oriented languages , 1996, OOPSLA '96.

[7]  R. Nigel Horspool,et al.  Efficient type inclusion tests , 1997, OOPSLA '97.

[8]  Brian W. Kernighan,et al.  The C Programming Language, Second Edition , 1988 .

[9]  David Grove,et al.  Optimization of Object-Oriented Programs Using Static Class Hierarchy Analysis , 1995, ECOOP.

[10]  Bertrand Meyer,et al.  Eiffel: The Language , 1991 .

[11]  F FernándezMary Simple and effective link-time optimization of Modula-3 programs , 1995 .

[12]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[13]  Craig Chambers,et al.  Debugging optimized code with dynamic deoptimization , 1992, PLDI '92.

[14]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[15]  Craig Chambers,et al.  Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches , 1991, ECOOP.

[16]  David Robson,et al.  Smalltalk-80: The Language and Its Implementation , 1983 .

[17]  Mary F. Fernández,et al.  Simple and effective link-time optimization of Modula-3 programs , 1995, PLDI '95.

[18]  Amer Diwan,et al.  Simple and effective analysis of statically-typed object-oriented programs , 1996, OOPSLA '96.

[19]  ChambersCraig,et al.  Call graph construction in object-oriented languages , 1997 .

[20]  Bjarne Stroustrup,et al.  The C++ programming language (2nd ed.) , 1991 .

[21]  Daniel G. Bobrow,et al.  CLOS: integrating object-oriented and functional programming , 1991, CACM.

[22]  Urs Hölzle,et al.  Adaptive optimization for self: reconciling high performance with exploratory programming , 1994 .

[23]  Greg Nelson,et al.  Systems programming in modula-3 , 1991 .

[24]  Mark Schlack,et al.  Digital Equipment Corp. , 1993 .

[25]  Andrew A. Chien,et al.  Precise Concrete Type Inference for Object-Oriented Languages , 1994, OOPSLA.

[26]  Andrew A. Chien,et al.  Precise concrete type inference for object-oriented languages , 1994, OOPSLA 1994.

[27]  Craig Chambers,et al.  Whole-program optimization of object-oriented languages , 1996 .