Inlining of Virtual Methods
David Detlefs5
and Ole Agesen5 
| (5) |
Sun Microsystems Laboratories, 1 Network Drive, Burlington, MA 01803-0902, USA |
Abstract
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.
★ Sun, Sun Microsystems, Java, and HotJava are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States
and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International,
Inc. in the United States and other countries. Products bearing SPARC trademarks are based upon an architecture developed
by Sun Microsystems, Inc.
References secured to subscribers.