Home
Scholarly Works
Mining Method Handle Graphs for Efficient Dynamic...
Conference

Mining Method Handle Graphs for Efficient Dynamic JVM Languages

Abstract

The Java Virtual Machine (JVM) has been used as an execution platform by many dynamically-typed programming languages such as Ruby, Python, and Groovy. The main challenge to compile such dynamic JVM languages is choosing the most appropriate implementation of a method for various types of an object at runtime. To address this challenge, a new Java bytecode instruction, invokedynamic, has been introduced, allowing users to control the linkage between a call site and a method implementation. With this instruction, a method handle that refers to a method is linked to the call site and then potentially transforms the invocation to a real implementation. As a referenced method of a method handle might in turn refer to other method handles, multiple method handles constitute a Method Handle Graph (MHG). In order to support more efficient dynamic JVM language implementations, we present methods to mine patterns in the method handle graph. We investigate two kinds of method handle patterns: the transformation pattern and the instance pattern. The transformation pattern refers to a composition of multiple method handle transformations, and the instance pattern refers to equivalent method handles in MHGs. Both patterns are mined by the presented suffix tree and equivalency detector, respectively, which are implemented as modules in the Method Handle Mining System (MHMS). Our experiments on the JRuby Micro-Indy benchmark reveal several findings: a) the frequency of different transformation patterns varies significantly, and the JRuby interpreter prefers a small number of transformation patterns, b) a large proportion of method handles, 28.83%, are equivalent, and most of these equivalent method handles can be eliminated to reduce consumed memory, and c) the distribution of equivalent sets for length-two method handle chains is also uneven. For example, only 7% of these sets have more than 30 equivalent method handle chains. We believe these insights are important steps towards further optimizations based on method handle graphs.

Authors

Xu S; Bremner D; Heidinga D

Pagination

pp. 159-169

Publisher

Association for Computing Machinery (ACM)

Publication Date

September 8, 2015

DOI

10.1145/2807426.2807440

Name of conference

Proceedings of the Principles and Practices of Programming on The Java Platform
View published work (Non-McMaster Users)

Contact the Experts team