Mixed-Language Call Stack Labels for Faster Stack Unwinding

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional methods for identifying stack frame types in a call stack with different types of stack frames during unwind stack processes are inefficient, requiring large data tables and impacting performance in non-unwind stack scenarios.

Innovation Solution

A method that involves adding a boundary function between functions with different high-level programming languages and storing return addresses with corresponding labels to determine stack frame types, eliminating the need for large data tables and reducing lookup times.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If a PC data table or data link table is maintained during runtime to identify stack frame types, then stack frame type identification can be performed, but the non-unwind stack scenario performance is greatly affected and stack tracing speed is low

Engineering Contradiction:
Improvestack frame type identification accuracyVSAvoidunwind stack performance
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The patent applies preliminary action by pre-generating return address information and stack frame type labels during the compilation phase rather than maintaining large data tables during runtime. The compiler analyzes function call relationships and generates return address sets with corresponding stack frame type labels in advance, eliminating the need for runtime table maintenance and lookup operations.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent extracts only the necessary return address information and stack frame type labels from the original large PC data table or data link table concepts. Instead of maintaining complete runtime tables, the solution extracts and stores only the pre-computed return address sets with their associated stack frame type information, significantly reducing runtime overhead.

Inventive Principle:
Principle #2Taking out (Extraction)

2Measurement precision

If a PC data table or data link table is maintained during runtime to identify stack frame types, then stack frame type identification can be performed, but device complexity increases due to runtime maintenance requirements

Engineering Contradiction:
Improvestack frame type identification accuracyVSAvoidruntime data structure maintenance
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent shifts the complexity from runtime to compile time by performing all necessary data structure generation during compilation. The compiler generates return address sets and stack frame type labels in advance, eliminating runtime maintenance of complex data structures like PC data tables or data link tables.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent replaces expensive, long-lived runtime data structures with lightweight, pre-generated information that can be discarded after unwind operations. The return address sets and labels are generated once during compilation and used efficiently during runtime without requiring ongoing maintenance or large memory allocations.

Inventive Principle:
Principle #27Cheap short-living objects (Disposable)

3Measurement precision

If conventional methods are used to identify stack frame types, then all stack frames can be processed, but the speed of stack tracing is low

Engineering Contradiction:
Improvestack frame type identification completenessVSAvoidstack tracing speed
Core Design Contradiction:
Measurement precisionVSSpeed

Solution Approach 1:

The patent performs preliminary analysis during compilation to identify all return addresses and their corresponding stack frame types. This pre-computation enables rapid runtime lookup without requiring sequential searching or complex runtime table maintenance, significantly improving stack tracing speed while maintaining completeness.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent replaces the mechanical process of runtime table maintenance and lookup with a more efficient system based on pre-computed return address sets. Instead of maintaining and searching large data structures during runtime, the solution uses directly accessible pre-generated information, substituting a slow mechanical process with a faster information retrieval mechanism.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentEP4345612B1Program call stack creation method, and stack backtrace method and apparatus
Publication Date: 2025.10.22 HUAWEI TECH CO LTD
  • EP4345612B1 patent drawingFigure 1
  • EP4345612B1 patent drawingFigure 2
  • EP4345612B1 patent drawingFigure 3

AI summary

This application discloses a program call stack creation method and apparatus, and an unwind stack method and apparatus. The call stack creation method includes: obtaining a first program, where the first program includes a first function; in a process of calling a runtime library to run the first program, adding a second function and creating a call stack, where the call stack includes a first stack frame, a second stack frame, and a third stack frame that are respectively corresponding to the first function, the second function, and a third function; there is a call relationship between the first function and the second function, and there is a call relationship between the second function and the third function; and the third function is a function in the runtime library or the first program, and a high-level programming language corresponding to the first function is different from a high-level programming language corresponding to the third function; and storing a label corresponding to a first return address, where the label indicates types of the first stack frame, the second stack frame, and the third stack frame. In this application, unwind stack performance can be improved to a maximum extent without affecting a non-stack trace scenario.