Dynamic Translator Partitioning for Self-Modifying Code

Resolve Bottlenecks,
Find Innovative Solutions
Generate 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

VSEngineering 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

Engineering Contradiction:
Improvetranslation productivityVSAvoidtime for identifying and discarding stale translations
Core Design Contradiction:
ProductivityVSLoss of time

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

Inventive Principle:
Principle #1Segmentation

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

Engineering Contradiction:
Improvetranslation optimizationVSAvoidcorrelation information between subject and target addresses
Core Design Contradiction:
ProductivityVSLoss of information

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

Inventive Principle:
Principle #24Intermediary (Mediator)

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

Engineering Contradiction:
Improvetranslation accuracyVSAvoidcomplexity of tracking translations
Core Design Contradiction:
ReliabilityVSDevice complexity

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

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS7934204B2Partitioning code in program code conversion
Publication Date: 2011.04.26 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US7934204B2 patent drawing
  • US7934204B2 patent drawing
  • US7934204B2 patent drawing

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.