Inline Function Linking for Dead Code Elimination
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing linker-level dead code elimination techniques consume significant processing power and energy, especially in real-time or power-sensitive devices, due to the need to evaluate thousands of functions to determine reachability, making them inefficient for sparse library utilization.
Innovation Solution
Implementing 'lazy' linking that copies only reachable library functions, performing inline dead code elimination by evaluating and selectively copying only the necessary functions, thereby reducing memory copies and power consumption.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the linker copies the entire library into the destination file, then all library functions are available for execution, but the memory consumption and processing power required increase significantly
Solution Approach 1:
The patent extracts only the necessary library functions that are actually referenced by the user-defined code into the destination file, rather than copying the entire library. This is achieved through a two-pass approach: first copying the user-defined code and identifying referenced library functions, then selectively copying only those specific functions. This extraction principle directly resolves the contradiction by maintaining function availability while reducing memory consumption.
Solution Approach 2:
The patent segments the library copying process into distinct phases: (1) copying user-defined code, (2) identifying referenced library functions through symbol table analysis, and (3) selectively copying only the necessary library portions. This segmentation allows the system to avoid copying unused library functions, thereby reducing memory consumption while ensuring all required functions are available.
2Manufacturing precision
If the linker evaluates all functions to determine reachability, then dead code elimination is effective, but the processing time and energy consumption increase substantially
Solution Approach 1:
The patent performs preliminary action by first copying the user-defined code to the destination file before evaluating library function reachability. This establishes a baseline that limits the scope of subsequent analysis to only those library functions referenced by the user code, rather than evaluating all library functions. This preliminary step significantly reduces processing time while maintaining elimination accuracy.
Solution Approach 2:
The patent extracts and analyzes only the symbol table information necessary to determine which library functions are referenced by user-defined code. By focusing analysis exclusively on this subset rather than all library functions, the system achieves effective dead code elimination with substantially reduced processing time and energy consumption.
3Quantity of substance
If the linker copies only referenced library functions, then memory consumption is reduced, but the complexity of determining reachability increases
Solution Approach 1:
The patent introduces symbol tables as an intermediary mechanism to manage the complexity of determining library function reachability. The symbol tables store references between user-defined code and library functions, allowing the linker to efficiently identify which library functions are needed without complex analysis. This intermediary structure reduces linker complexity while enabling selective copying to reduce memory consumption.
Solution Approach 2:
The patent uses copying of symbol table information from the user-defined code to identify referenced library functions. This copying approach is simpler than performing complex reachability analysis, as it directly reveals which library functions are needed. The symbol table copying mechanism manages complexity while enabling the selective copying strategy that reduces memory consumption.
4Use of energy by moving object
If the linker performs selective copying of library functions, then power consumption is reduced, but the time required to identify reachable functions increases
Solution Approach 1:
The patent performs preliminary action by establishing the user-defined code in the destination file first, which defines the boundary for subsequent analysis. This preliminary step reduces the scope of power-consuming analysis to only library functions referenced by user code, rather than all library functions. The time required is reduced because the analysis scope is pre-limited by the user code boundaries.
Solution Approach 2:
The symbol tables serve as an intermediary that reduces both power consumption and identification time. By using pre-computed symbol table information rather than performing complex reachability analysis, the system minimizes power-consuming operations while quickly identifying reachable functions through direct symbol table lookup and analysis.
Data Source
AI summary
In general, techniques are described for performing a form of inline dead code elimination. An apparatus comprising a storage unit and a processor may implement these techniques. The storage unit stores two source files and a destination file. The processor copies a first one of the source files to the destination file. This first source file includes a reference to a portion of a second one of the source files. The processor then evaluates the destination file to determine whether the portion of the second source file referenced in the first source file is used by the destination file. Based on the determination that the portion of the second source file referenced in the first source file is used by the destination file, the processor selectively copies the portion of the second source file to the destination file to generate an updated destination file.


