Program Analysis Using Function Summaries to Avoid Code Inlining

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing program analysis methods face challenges such as exponential code size due to inlining function calls, difficulty in building a complete monolithic software representation, lack of source code for library functions, noise from false positives, and providing inter-procedural counter-examples, which hinder effective analysis.

Innovation Solution

A computer-implemented method that uses summaries to analyze programs by determining input and output variable assignments to reach a predefined state, refining summaries using SMT or SAT solvers, and storing narrowed summaries to avoid inlining functions, enabling parallel processing and reducing false positives.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If function calls are inlined to analyze program code, then analysis completeness is improved, but code size becomes exponential in the number of nested function calls

Engineering Contradiction:
Improveanalysis completenessVSAvoidcode size
Core Design Contradiction:
ReliabilityVSVolume of moving object

Solution Approach 1:

The patent divides the program analysis into separate function analysis units, where each function is analyzed independently using summaries rather than inlining the entire function body. This segmentation allows analysis of large programs without exponential code expansion, as summaries provide compact representations of function behavior.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces summaries as intermediary representations between function calls and function bodies. These summaries act as mediators that capture essential function behavior without requiring full inlining, thus maintaining analysis completeness while avoiding exponential code size growth.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If pessimistic summaries are used to find error conditions, then error detection capability is improved, but false positives increase

Engineering Contradiction:
Improveerror detection capabilityVSAvoidfalse positives
Core Design Contradiction:
ReliabilityVSObject-generated harmful factors

Solution Approach 1:

The patent implements feedback loops where analysis results from pessimistic summaries are used to refine and narrow the summaries iteratively. This feedback mechanism reduces false positives by continuously improving summary accuracy based on actual program behavior observations while maintaining initial error detection capability.

Inventive Principle:
Principle #23Feedback

Data Source

PatentUS9760469B2Analysis of program code
Publication Date: 2017.09.12 BLACK DUCK SOFTWARE INC
  • US9760469B2 patent drawing
  • US9760469B2 patent drawing
  • US9760469B2 patent drawing

AI summary

This disclosure relates to the analysis of a program based on source code where the source code comprises a call to a function associated with a function implementation. A processor determines, based on a summary that over-approximates the function, an assignment of an input variable and an output variable of the function call to reach a predefined state. The processor then determines, based on the implementation of the function whether the assignment of the input variable results in the assignment of the output variable. If it does not, the processor determines a narrowed summary for the function such that the narrowed summary over-approximates the function and excludes the assignment of the input variable and the output variable. Finally, the processor stores the narrowed summary on a datastore. Inlining of function code and unfolding of loops is avoided and parallel processing of multiple functions is possible.