Branch Stubs for Direct Cache Execution

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Modern multiprocessor architectures face challenges in efficiently executing code segments larger than the local store or cache size, as branch instructions often target code segments not currently in the local store or cache, requiring strategies to bring in necessary code segments from main memory.

Innovation Solution

The method involves generating branch stubs by a compiler to store information about original branch instructions, allowing the compiler to rewrite branch instructions so that their targets reference the branch stubs, enabling direct execution to the target instruction in the instruction cache without intervention from the instruction cache runtime system, and dynamically updating these stubs at runtime.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If code segments are swapped into local store from main memory to enable execution, then code execution capability is improved, but system complexity and overhead increase due to requiring runtime intervention for cache management

Engineering Contradiction:
Improvecode execution capabilityVSAvoidruntime system intervention
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent applies preliminary action by pre-generating branch stubs during compilation that contain target address information. This allows the branch instruction to be rewritten to reference the stub, enabling direct execution without runtime cache management intervention. The stub is prepared in advance with all necessary information to redirect execution directly to the target code segment in the instruction cache.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The branch stub acts as an intermediary between the branch instruction and the target code segment. Instead of requiring runtime system intervention to manage cache swaps, the stub serves as a pre-prepared mediator that contains the target address and enables direct redirection of execution flow to the desired code segment already present in the instruction cache.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Speed

If branch instructions directly reference target addresses, then execution speed is improved, but reliability decreases when target code segments are not present in local store

Engineering Contradiction:
Improveexecution speedVSAvoidbranch target availability
Core Design Contradiction:
SpeedVSReliability

Solution Approach 1:

The patent applies preliminary action by loading the target code segment into the instruction cache before the branch instruction is executed. The compiler generates a branch stub that references the target address, and the runtime system ensures the target code is present in the instruction cache before execution, making the direct branch both fast and reliable.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The branch stub serves as an intermediary that bridges the gap between direct branching and cache management. It contains the target address information and enables direct execution when the target is available in the instruction cache, while the runtime system uses the stub as a reference point to ensure target availability before enabling direct execution.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Productivity

If branch stubs are generated and used for direct execution, then overhead is reduced and performance improves, but device complexity increases due to stub generation and management mechanisms

Engineering Contradiction:
Improveexecution performanceVSAvoidstub generation and management
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent applies preliminary action by generating branch stubs during the compilation phase rather than at runtime. The compiler analyzes the code, identifies branch instructions, and generates corresponding stubs with target address information. This shifts the complexity from runtime to compile time, improving runtime performance while managing complexity through static analysis.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The branch stub is self-contained with all necessary information (target address) to enable direct execution. Once generated, the stub serves itself by providing the redirection information without requiring ongoing runtime system intervention, reducing the management overhead despite the initial complexity of stub generation.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS8713548B2Rewriting branch instructions using branch stubs
Publication Date: 2014.04.29 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US8713548B2 patent drawing
  • US8713548B2 patent drawing
  • US8713548B2 patent drawing

AI summary

Mechanisms are provided for rewriting branch instructions in a portion of code. The mechanisms receive a portion of source code having an original branch instruction. The mechanisms generate a branch stub for the original branch instruction. The branch stub stores information about the original branch instruction including an original target address of the original branch instruction. Moreover, the mechanisms rewrite the original branch instruction so that a target of the rewritten branch instruction references the branch stub. In addition, the mechanisms output compiled code including the rewritten branch instruction and the branch stub for execution by a computing device. The branch stub is utilized by the computing device at runtime to determine if execution of the rewritten branch instruction can be redirected directly to a target instruction corresponding to the original target address in an instruction cache of the computing device without intervention by an instruction cache runtime system.