Flow-Sensitive Type Constraint Analysis for Dead Code Elimination

Resolve Bottlenecks,
Find Innovative Solutions
Generate 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

VSEngineering 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

Engineering Contradiction:
Improvememory usageVSAvoiddead code elimination effectiveness
Core Design Contradiction:
Quantity of substanceVSProductivity

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.

Inventive Principle:
Principle #35Parameter changes

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.

Inventive Principle:
Principle #1Segmentation

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

Engineering Contradiction:
Improvecode reuse capabilityVSAvoidmemory requirements
Core Design Contradiction:
Adaptability or versatilityVSQuantity of substance

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.

Inventive Principle:
Principle #2Taking out (Extraction)

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

Engineering Contradiction:
Improvepolymorphism capabilityVSAvoiddead executable code
Core Design Contradiction:
Adaptability or versatilityVSQuantity of substance

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.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentUS7669193B1Program transformation using flow-sensitive type constraint analysis
Publication Date: 2010.02.23 LANTRONIX INC
  • US7669193B1 patent drawing
  • US7669193B1 patent drawing
  • US7669193B1 patent drawing

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.