Delayed Exception Handling for Code Motion Optimization

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Optimizing compilers face limitations in moving code that may raise exceptions, as this can alter program semantics and result in different execution outcomes, particularly in environments where many instructions may raise exceptions, leading to inhibited code motion.

Innovation Solution

Implementing a system to selectively delay exceptions raised by relocated instructions, using data structures to track relocation information and managing exceptions at runtime to ensure they are handled at the original intended location, allowing for more flexible code optimization while preserving exception order and results.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Speed

If code is moved to optimize performance, then execution speed is improved, but program semantics may change due to exception ordering

Engineering Contradiction:
Improveexecution speedVSAvoidprogram semantics
Core Design Contradiction:
SpeedVSReliability

Solution Approach 1:

The compiler performs preliminary analysis to identify exceptions that would be raised by relocated code and pre-generates delayed exception handling mechanisms. This allows code to be safely relocated while maintaining exception ordering through runtime delay of exception handling until the original location is reached.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

A delayed exception handling mechanism acts as an intermediary between the relocated code and the exception handling system. This intermediary delays the actual exception handling until the appropriate time (when the original location is executed), thereby preserving program semantics while allowing code relocation for optimization.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If code motion is restricted to preserve exception order, then program semantics are maintained, but code optimization capability is reduced

Engineering Contradiction:
Improveprogram semanticsVSAvoidcode optimization capability
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The compiler performs preliminary analysis to identify exceptions that would be raised by relocated code and pre-generates delayed exception handling mechanisms. This allows code to be safely relocated while maintaining exception ordering through runtime delay of exception handling until the original location is reached.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The exception handling mechanism transitions from a static approach (where code cannot be relocated) to a dynamic approach where exceptions are delayed until the appropriate time. This dynamic delay mechanism allows flexible code motion while preserving semantic correctness at runtime.

Inventive Principle:
Principle #15Dynamics

3Device complexity

If exceptions are handled immediately at relocation point, then exception handling is simple, but computation results may be lost due to out-of-order handling

Engineering Contradiction:
Improveexception handling complexityVSAvoidcomputation results
Core Design Contradiction:
Device complexityVSLoss of information

Solution Approach 1:

The compiler performs preliminary analysis to identify exceptions that would be raised by relocated code and pre-generates delayed exception handling mechanisms. This allows code to be safely relocated while maintaining exception ordering through runtime delay of exception handling until the original location is reached.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The delayed exception handling mechanism ensures continuous preservation of computation results by maintaining the logical sequence of exception handling. Even though code is relocated, the exception handling continues in the correct order by delaying until the original location is executed, preventing loss of computation results.

Inventive Principle:
Principle #20Continuity of useful action

Data Source

PatentUS7930707B2Optimizing code motion with delayed exception handling
Publication Date: 2011.04.19 ORACLE INT CORP
  • US7930707B2 patent drawing
  • US7930707B2 patent drawing
  • US7930707B2 patent drawing

AI summary

Systems, methods, media, and other embodiments associated with optimizing code motion with delayed exception handling are described. One exemplary system embodiment includes a data store to store information about a relocated instruction, a relocation logic to relocate instructions, and a run-time logic to detect exceptions raised by executed instructions. The run-time logic may selectively delay handling exceptions based on whether an executed instruction is a relocated instruction.