Characterization of call-graph profiles in Java workloads
Abstract
Method inlining is a standard optimization in optimizing compilers. Java Just-In-Time (JIT) compilers use a size threshold for their inlining decisions. They favor inlining methods that are smaller than the threshold and do not inline the other larger methods. This has been a simple and effective strategy, but we should be able to make even better inlining based on a cost-benefit model, assuming accurate and lightweight call-graph profiles. We characterized the call-graph profiles of twelve SPECjvm2008 benchmarks with two metrics, method size and call frequency, to study the opportunities that make better tradeoff between performance benefits and compilation costs over the existing size-based inlining algorithm in the dynamic compilation environment. We found that inlining methods that are smaller than a size threshold is not always beneficial for performance. Most of the call-graph edges to the small methods had quite low call frequencies. Excluding the low-weighted call-graph edges from inlining can be an opportunity to reduce the compilation cost. On the other hand, a few call-graph edges to the methods that are larger than the threshold had high call frequencies. Inlining the highly-weighted call-graph edges can be an opportunity to improve performance. We developed a new cost-benefit-based inlining algorithm to capture those identified opportunities and to make inlining decisions more cost effective. Our evaluation showed that the new algorithm improves performance significantly while reduces the compilation cost, compared to the widely-used size-based inlining algorithm.