Merging Identical Code Entities Without Address Conflicts
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Large binary programs often contain identical functions or read-only data members that, when merged, can lead to incorrect behavior during execution due to address-related operations, posing a risk in optimization efforts.
Innovation Solution
A method and system for optimizing executable programs by identifying and merging identical program entities, such as functions or read-only data members, while ensuring no operations from the second set operate on the address of the second program entity, and combining the updated object code units into the executable program, using techniques like code folding and insertion of predefined instructions.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Quantity of substance
If identical program entities are merged into a single copy, then the size of the binary program is reduced, but the program may behave incorrectly during execution due to address-related operations
Solution Approach 1:
The patent applies local quality by differentiating the treatment of program entities based on whether they perform address-related operations. Identical entities that do not perform address operations are merged, while those that do perform address operations are kept separate. This selective merging approach optimizes binary size for a subset of entities without compromising the reliability of entities that require distinct addresses.
2Productivity
If identical functions or read-only data members are merged, then code reduction is achieved, but the risk of incorrect behavior increases
Solution Approach 1:
The patent implements feedback by analyzing the operations associated with each program entity before merging. The system checks whether entities perform address-related operations and uses this feedback information to determine whether merging is safe. This feedback mechanism prevents harmful merges while allowing beneficial code reduction.
Solution Approach 2:
The patent applies preliminary action by performing an analysis of program entities and their operations before executing the merging process. The system identifies which entities are safe to merge in advance, preparing a plan that avoids merging entities with address-related operations. This preliminary analysis prevents incorrect behavior from occurring during execution.
Data Source
AI summary
A system and method for optimizing the object codes of a computer program is disclosed. The method includes receiving one or more object code units associated with an executable program; identifying, among the object code units, a first program entity and a first set of operations associated with the first program entity and a second program entity and a second set of operations associated with the second program entity, each program entity having an object code segment and an associated address; updating the object code units by inserting a predefined instruction before the first program entity's object code segment and causing the second set of operations to be associated with the predefined instruction if the first program entity's object code segment is identical to the second program entity's object code segment; and combining the updated object code units into the executable program.


