Function-Level Redundancy Detection via Static-Dynamic Hybrid Analysis

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current compiler optimization tools are limited in detecting and eliminating redundancies in code, as they either rely on static analysis with limited scope or require runtime tools that cannot directly affect compilation.

Innovation Solution

A programming language library that provides instrumentation and optimization tools to detect function-level redundancies by using code wrappers and linked computer-executable tools to analyze and optimize code at runtime, identifying pure functions and implementing return value reuse to eliminate redundant computations.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Loss of time

If compiler-level static analysis is used to detect redundancies, then optimization can be performed prior to compilation, but the scope of detectable redundancies is limited and superficial

Engineering Contradiction:
Improvecompilation timeVSAvoidredundancy detection accuracy
Core Design Contradiction:
Loss of timeVSMeasurement precision

Solution Approach 1:

The patent applies preliminary action by performing static analysis during compilation to identify candidate pure functions and insert instrumentation code before runtime execution. This preliminary identification allows the system to prepare for more accurate redundancy detection without waiting for runtime data collection.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent uses an intermediary approach by introducing a hybrid analysis system that combines compiler-level static analysis with runtime dynamic analysis. The static analysis phase identifies candidates, while runtime instrumentation provides precise verification, creating a bridge between the limitations of pure static and pure dynamic approaches.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Measurement precision

If runtime tools are used to detect redundancies, then actual execution behavior can be monitored, but the tools cannot directly eliminate redundancies prior to compilation

Engineering Contradiction:
Improveredundancy detection accuracyVSAvoidoptimization efficiency
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The system performs preliminary static analysis during compilation to identify candidate functions for purity analysis, preparing data structures and instrumentation code in advance. This reduces the runtime overhead by focusing dynamic analysis only on identified candidates rather than all functions.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent implements feedback by using runtime execution data to verify purity assumptions made during static analysis. The system monitors actual function behavior, compares it against static analysis predictions, and uses this feedback to confirm or correct redundancy identifications, enabling direct elimination of verified redundancies.

Inventive Principle:
Principle #23Feedback

3Measurement precision

If instrumentation code is inserted to perform dynamic analysis, then precise redundancy detection is enabled, but the complexity of the compilation process increases

Engineering Contradiction:
Improveredundancy detection accuracyVSAvoidcompilation system complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent segments the optimization process into distinct phases: static analysis phase during compilation, runtime instrumentation phase during execution, and feedback integration phase for final optimization decisions. Each phase handles specific tasks independently, reducing overall system complexity by avoiding the need for a single monolithic complex system.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The instrumentation code serves multiple functions: it tracks function inputs and outputs for purity verification, collects runtime execution data for redundancy detection, and provides feedback to the optimization system. This multi-functionality reduces the need for separate specialized components, simplifying the overall system architecture.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Data Source

PatentUS11704101B2Function-level redundancy detection and optimization
Publication Date: 2023.07.18 ALIBABA GROUP HOLDING LTD
  • US11704101B2 patent drawing
  • US11704101B2 patent drawing
  • US11704101B2 patent drawing

AI summary

The present disclosure provides computer-executable tools which, implemented in a programming language library, may enable source code written using the library to be compiled to object code instrumented for function-level dynamic analysis of memory allocation functions. By tracking heap reads and writes of each target function, symbols may be mapped to memory addresses allocated therefor, and values of input arguments of functions may be mapped to values of output returns. Based on this information, pure functions which embody redundant computations across multiple executions thereof may be identified, while non-pure functions may be screened out. Among pure functions, candidate functions which are executed having the same arguments and returns across multiple executions thereof may be identified, and these functions may be re-compiled to generate object code wherein redundant subsequent executions are avoided, and return values from a first execution thereof are reused across subsequent executions, reducing computational cost.