Dynamic Translator Partitioning for Self-Modifying Code
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Dynamic translators face challenges in identifying and invalidating target code translations when self-modifying code modifies its own code, leading to difficulties in correlating and discarding affected translations, especially in situations where optimizations result in translations that cannot be exactly matched to subject addresses.
Innovation Solution
The implementation of a partitioning technique that divides the subject code space into non-overlapping regions, allowing only affected partitions to be discarded when self-modifying code is detected, thereby limiting the need for retranslation and enabling thread-safe modifications in multithreaded programs.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If the translator translates successive basic blocks of subject program code into target code, then translation productivity is improved, but when self-modifying code modifies subject code, all translations of modified subject code must be identified and discarded as stale, increasing translation overhead and reducing productivity
Solution Approach 1:
The translator divides the subject code space into non-overlapping partitions, where each partition contains a distinct set of basic blocks and their corresponding target code translations. This segmentation allows the system to track and invalidate only the specific partitions affected by self-modifying code, rather than all translations, thereby reducing the time overhead while maintaining productivity benefits
2Productivity
If optimizations are applied during translation that yield translations not exactly correlated to subject address ranges, then translation quality and performance are improved, but the translator loses the ability to identify which translated target code corresponds to modified subject addresses
Solution Approach 1:
The patent introduces partition data structures as an intermediary layer between the optimized translations and the subject code addresses. Each partition maintains metadata that correlates ranges of subject addresses with their corresponding target code, even when optimizations are applied. This intermediary structure preserves the necessary correlation information without restricting the application of optimizations
3Reliability
If the translator must identify all target code sequences corresponding to modified subject addresses, then translation accuracy is maintained, but the complexity of tracking and managing translations increases
Solution Approach 1:
By segmenting the code space into partitions with distinct non-overlapping address ranges, the system simplifies the tracking process. Each partition maintains a clear correlation between subject and target addresses, making it easier to identify affected translations while maintaining accuracy. The partition structure provides a systematic organization that reduces the complexity of managing translations compared to a unified approach
Data Source
AI summary
A partitioning technique utilized by a translator to divide the subject code space into regions, referred to hereafter as partitions, where each partition contains a distinct set of basic blocks of subject code and corresponding target code. The partitioning technique divides the translator's representation of subject code and subject code translations into non-overlapping regions of subject memory. In this manner, when the subject program modifies subject code, only those partitions actually affected by the self-modifying code need be discarded and all translations in unaffected partitions can be kept. This partitioning technique is advantageous in limiting the amount of target code that must be retranslated in response to self-modifying code operation. In another process, the partitioning technique allows multithreaded subject programs that also involve self-modifying code to perform code modification in a thread-safe manner.


