Compiler Inlining via Dynamic Cost-Benefit Analysis

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing compilers rely heavily on hand-tuned heuristics for inlining function calls, which is inefficient and does not effectively optimize program execution due to the difficulty in deciding which functions to inline.

Innovation Solution

A method that calculates a cost value and a benefit value for inlining a child method into a root method, using an expanded call graph and a dynamic threshold to determine the inlining priority, allowing for incremental call graph exploration and budget-driven optimization.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of manufacture

If hand-tuned heuristics are used for inlining decisions, then implementation simplicity is maintained, but optimization effectiveness deteriorates

Engineering Contradiction:
Improveimplementation simplicityVSAvoidoptimization effectiveness
Core Design Contradiction:
Ease of manufactureVSProductivity

Solution Approach 1:

The patent changes the parameters of inlining decisions by calculating cost values and benefit values for each function call site. Instead of using fixed hand-tuned heuristics, the system dynamically computes metrics such as the cost of inlining (code size increase, compilation time) and benefit (execution time reduction, memory usage improvement) to make data-driven inlining decisions that optimize program execution efficiency.

Inventive Principle:
Principle #35Parameter changes

Solution Approach 2:

The system performs self-service by automatically analyzing the program's call graph and making inlining decisions without requiring manual intervention. The compiler autonomously expands the call graph, calculates cost-benefit ratios, and selects which functions to inline based on the computed metrics, eliminating the need for hand-tuned heuristics while maintaining implementation feasibility.

Inventive Principle:
Principle #25Self-service

2Manufacturing precision

If comprehensive call graph analysis is performed to improve inlining decisions, then optimization quality improves, but computational complexity increases

Engineering Contradiction:
Improveoptimization qualityVSAvoidcomputational complexity
Core Design Contradiction:
Manufacturing precisionVSDevice complexity

Solution Approach 1:

The patent applies partial action by selectively expanding only the necessary portions of the call graph rather than performing exhaustive analysis of the entire program. The system expands the call graph incrementally, focusing on hot paths and frequently called functions, and stops expansion when sufficient information is obtained to make inlining decisions, thus reducing computational complexity while maintaining optimization quality.

Inventive Principle:
Principle #16Partial or excessive action

Solution Approach 2:

The call graph analysis is segmented into multiple phases: initial call graph construction, selective expansion of relevant subgraphs, cost-benefit calculation for specific call sites, and iterative inlining decisions. This segmentation allows the compiler to manage computational complexity by processing only the necessary portions of the program at each stage rather than analyzing the entire program monolithically.

Inventive Principle:
Principle #1Segmentation

3Adaptability or versatility

If dynamic threshold adjustment is used for inlining priority, then adaptability to different programs improves, but decision-making complexity increases

Engineering Contradiction:
Improveprogram adaptabilityVSAvoiddecision-making complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent implements dynamic threshold adjustment where the inlining priority threshold is not fixed but adapts based on program characteristics, call graph depth, and observed performance metrics. The system dynamically modifies the threshold during compilation to balance inlining benefits against code size and compilation time, allowing adaptability to different program types while using systematic rules to manage decision-making complexity.

Inventive Principle:
Principle #15Dynamics

Data Source

PatentUS10466987B2Enhancing program execution using optimization-driven inlining
Publication Date: 2019.11.05 ORACLE INT CORP
  • US10466987B2 patent drawing
  • US10466987B2 patent drawing
  • US10466987B2 patent drawing

AI summary

Optimizing program execution includes performing, to obtain an expanded call graph, an expansion of an initial call graph. The expanded call graph includes nodes. The initial call graph is defined for a program that includes a root method and a child method. The method may further include calculating a cost value and a benefit value for inlining the child method, calculating an inlining priority value as a function of the cost value and the benefit value, and inlining, based on analyzing the expanded call graph and comparing the inlining priority value to a dynamic threshold, the child method into the root method. The child method may correspond to a node in the expanded call graph.