Flow-Sensitive Type Constraint Analysis for Dead Code Elimination
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for reducing dead code in object-oriented programming languages, particularly in managed runtime environments, are incomplete as they are flow-insensitive and fail to efficiently eliminate unused virtual functions and native function calls, leading to increased memory usage and performance issues, especially in resource-constrained systems like embedded systems.
Innovation Solution
A flow-sensitive type constraint analysis method that analyzes program instructions at the intermediate language level, tracking object types along specific execution paths to determine required functions and eliminate unused code, including virtual functions and native function calls, by creating a call graph and managing type constraints locally.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Quantity of substance
If flow-insensitive analysis is used to eliminate dead code, then some unused functions can be removed, but virtual functions and native function calls cannot be efficiently eliminated, leading to increased memory usage
Solution Approach 1:
The patent changes the analysis parameter from flow-insensitive to flow-sensitive type constraint analysis. This enables tracking of object types along specific execution paths, allowing the system to determine which virtual functions and native function calls are actually required by the program, thereby eliminating more dead code while reducing memory usage.
Solution Approach 2:
The patent segments the analysis into local type constraint analysis at the intermediate language instruction level and every call path. By breaking down the analysis into smaller, path-specific segments, the system can precisely determine which functions are needed without over-approximating, enabling elimination of virtual functions and native function calls that flow-insensitive methods miss.
2Adaptability or versatility
If object-oriented programming features are used to enable code reuse, then library functionality can be reused across applications, but memory requirements increase due to inclusion of unused library functionality
Solution Approach 1:
The patent extracts only the specific library functionality that is actually used by the program through flow-sensitive type constraint analysis. By tracking object types along execution paths and determining required functions, the system can include only the necessary virtual functions and library code, excluding unused library functionality while maintaining code reuse benefits.
3Adaptability or versatility
If virtual functions are used to enable polymorphism, then programs can operate on any object type, but dead executable code increases because no fixed code address can be associated with method calls
Solution Approach 1:
The patent changes from flow-insensitive analysis to flow-sensitive type constraint analysis, enabling precise tracking of object types along execution paths. This allows the system to determine which virtual functions are actually called despite polymorphism, eliminating dead executable code while preserving polymorphic capabilities.
Data Source
AI summary
A method for analyzing a program is provided. The method includes, determining an object type that may exist at an execution point of the program, wherein this enables determination of possible virtual functions that may be called; creating a call graph at a main entry point of the program; and recording an outgoing function call within a main function. The method also includes analyzing possible object types that may occur at any given instruction from any call path for virtual calls, wherein possible object types are determined by tracking object types as they pass through plural constructs; and calling into functions generically for handling specialized native runtime type information.


