Caching Runtime Variables via Simulation State Mapping

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Debugging optimized code is challenging due to non-constant variable offsets and unknown register mappings, which prevent compilers from efficiently accessing and caching data, leading to stale data presentation during debugging.

Innovation Solution

A method and system that compile live range statements with simulation state variables to dynamically map variables in cache, using content addressable memory to determine the presence of variables in cache and optimize data access, allowing for efficient lookup and debugging of non-constant offset variables.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Speed

If a compiler caches memory operands in registers to avoid high latency memory accesses, then memory access speed is improved, but debugging capability deteriorates because variable offsets become non-constant and register mappings are unknown at compile-time

Engineering Contradiction:
Improvememory access speedVSAvoiddebugging capability
Core Design Contradiction:
SpeedVSEase of operation

Solution Approach 1:

The patent introduces an intermediary mechanism between the optimized code execution and the debugger. This intermediary maintains a mapping between original source-level variables and their cached register locations, allowing the debugger to indirectly access cached variables through the original variable names while the optimized code continues to use registers for fast access.

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent segments the variable storage into multiple locations: original memory locations, cached register locations, and debugger interface locations. This segmentation allows different components (optimized code, debugger, and mapping mechanism) to access variables in ways optimized for their specific needs without interfering with each other.

Inventive Principle:
Principle #1Segmentation

2Measurement precision

If a compiler generates live ranges for debugging with constant offsets and known register mappings, then debugging accuracy is improved, but code optimization capability deteriorates because such compilers cannot handle non-constant offsets or unknown mappings

Engineering Contradiction:
Improvedebugging accuracyVSAvoidcode optimization capability
Core Design Contradiction:
Measurement precisionVSAdaptability or versatility

Solution Approach 1:

The patent makes the variable-to-register mapping dynamic rather than static. The mapping is determined at runtime based on the actual register allocations and cache locations, allowing the system to adapt to any optimization the compiler performs while still providing accurate debugging information through the intermediary mapping mechanism.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent changes the parameter of variable offset from constant to variable by introducing an intermediary layer. The intermediary translates static debugger variable references into dynamic register addresses, allowing the system to support both constant and non-constant offsets while maintaining debugging accuracy.

Inventive Principle:
Principle #35Parameter changes

3Productivity

If a compiler performs aggressive optimizations with code reordering and duplication, then execution efficiency is improved, but traceability of original variables deteriorates making debugging difficult

Engineering Contradiction:
Improveexecution efficiencyVSAvoidvariable traceability
Core Design Contradiction:
ProductivityVSLoss of information

Solution Approach 1:

The patent creates a copy of the variable mapping information that is separate from the optimized code structure. This mapping copy maintains the relationship between original variables and their cached locations regardless of code reordering or duplication, allowing the debugger to trace variables accurately even when the optimized code structure is significantly transformed.

Inventive Principle:
Principle #26Copying

Data Source

PatentUS8479183B2Caching run-time variables in optimized code
Publication Date: 2013.07.02 MARVELL ASIA PTE LTD
  • US8479183B2 patent drawing
  • US8479183B2 patent drawing
  • US8479183B2 patent drawing

AI summary

In one embodiment, the present invention includes a method for emitting a live range statement into a program for a memory variable to be cached during run-time that has at least one simulation state variable if the memory variable is dynamically mapped, and defining the simulation state variable at a first execution path of the program. In such manner, the program may be optimized using the live range statement and the simulation state variable. Also, a debugger may use the simulation state variables in obtaining and displaying the memory variable from a cache.