Tail-Call Jump Instrumentation via Exception Trampolines

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing virtualized computer system monitoring tools, such as VProbes, struggle to instrument function exits in tail-call optimized code, as tail-call optimizations eliminate return instructions, making it difficult to trap and instrument function exits without disrupting system performance.

Innovation Solution

The proposed solution involves a probe engine that identifies tail-call jumps in optimized code, instruments these jumps to raise exceptions, and uses a trampoline to transfer control and fire exit probes, ensuring that function exits can be instrumented even in optimized code, thereby allowing for dynamic probing without system disruption.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If tail-call optimization is applied to eliminate return instructions, then code efficiency is improved, but function exit instrumentation becomes impossible

Engineering Contradiction:
Improvecode efficiencyVSAvoidfunction exit instrumentation
Core Design Contradiction:
ProductivityVSDifficulty of detecting and measuring

Solution Approach 1:

The system performs preliminary identification of tail-call jump instructions before instrumentation is applied. By detecting tail-call patterns in advance and preparing trampoline handlers, the system can intercept these optimized calls and convert them into instrumentable forms without disrupting the original optimization benefits.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

A trampoline function serves as an intermediary between the tail-call jump and the target function. The trampoline receives the jump, performs the actual function call, and then returns control, allowing probe instrumentation to be inserted at the trampoline's return point rather than at the original tail-call site where no return instruction exists.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If probes are injected into running virtual machines, then dynamic monitoring is enabled, but system state stability may be compromised

Engineering Contradiction:
Improvedynamic monitoringVSAvoidsystem state stability
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The system implements feedback mechanisms where probe scripts are validated and checked before being injected into running virtual machines. The probe engine monitors system state changes and can abort or rollback instrumentation if stability thresholds are violated, ensuring that dynamic monitoring does not compromise system reliability.

Inventive Principle:
Principle #23Feedback

3Reliability

If probe scripts are validated at runtime, then system security is improved, but probing overhead increases

Engineering Contradiction:
Improvesystem securityVSAvoidprobing overhead
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

Probe scripts undergo validation and security checking in advance before being loaded into the runtime environment. By performing syntax validation, infinite loop detection, and security checks beforehand, the runtime overhead during actual probing operations is minimized while maintaining strong security guarantees.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS10089126B2Function exit instrumentation for tail-call optimized code
Publication Date: 2018.10.02 VMWARE INC
  • US10089126B2 patent drawing
  • US10089126B2 patent drawing
  • US10089126B2 patent drawing

AI summary

Function exits are instrumented in tail-call optimized code in which calls to target functions and return instructions are replaced by jump instructions. A probe engine identifies a tail-call jump and instruments the jumps to raise an exception. In response to an exception raised at the tail-call jump, an exception handler loads various registers and transferring control to a trampoline, which calls the jump target. After the target function returns, an exit probe is fired when the trampoline itself returns.