Function Calling Context Encoding for Multithread Distinction

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing methods for distinguishing function calling contexts in multiple threads result in high storage overheads and inefficient analysis due to the need for decoding to obtain thread information, affecting analysis precision and efficiency.

Innovation Solution

An encoding method that encodes the calling context of a function based on thread and function creation relationships, using a thread calling context encoding graph (TEG) and function calling context encoding graph (CEG), allowing for efficient distinction of contexts without decoding, thus reducing storage and analysis time.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If function call string is used to distinguish different calling contexts, then analysis precision is improved, but storage overhead is excessively high

Engineering Contradiction:
Improveanalysis precisionVSAvoidstorage overhead
Core Design Contradiction:
Measurement precisionVSQuantity of substance

Solution Approach 1:

The patent transforms the function call string from a full textual representation to a compressed encoding format. By changing the parameter representation from complete strings to encoded values, the system maintains the ability to distinguish different calling contexts while dramatically reducing storage requirements. The encoding preserves the essential identifying information without storing the complete function call paths.

Inventive Principle:
Principle #35Parameter changes

2Quantity of substance

If function call string is encoded to reduce storage overhead, then storage overhead is reduced, but thread information cannot be distinguished

Engineering Contradiction:
Improvestorage overheadVSAvoidthread distinction capability
Core Design Contradiction:
Quantity of substanceVSMeasurement precision

Solution Approach 1:

The patent segments the calling context information into separate components: function call path information and thread information. By dividing the encoding into distinct segments, the system can compress the function call path while maintaining separate, identifiable thread information. This segmentation allows both components to be efficiently stored and processed independently.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces thread ID as an intermediary element that directly identifies the thread without requiring decoding of the full function call string. The thread ID acts as a mediator between the compressed function call encoding and the original thread information, enabling efficient thread distinction without the need for complete string storage or repeated decoding operations.

Inventive Principle:
Principle #24Intermediary (Mediator)

3Ease of operation

If thread information is obtained through repeated decoding, then thread information can be accessed, but analysis time overhead is large

Engineering Contradiction:
Improvethread information accessibilityVSAvoidanalysis time overhead
Core Design Contradiction:
Ease of operationVSLoss of time

Solution Approach 1:

The patent performs preliminary encoding of thread information alongside the function call encoding. By preparing and storing the thread ID in advance during the encoding process, the system eliminates the need for repeated decoding operations during analysis. The thread information is ready for immediate access without requiring time-consuming decoding operations.

Inventive Principle:
Principle #10Preliminary action

4Measurement precision

If function call string is stored to distinguish calling contexts, then analysis precision is improved, but device complexity increases

Engineering Contradiction:
Improvecalling context distinctionVSAvoidstorage and processing complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent changes the data representation parameters from complete function call strings to compressed encoded values. This parameter transformation reduces the amount of data that needs to be stored and processed, thereby reducing device complexity while maintaining the ability to distinguish different calling contexts with the same analysis precision.

Inventive Principle:
Principle #35Parameter changes

Data Source

PatentEP4290372B1Function calling context encoding method and apparatus, and function calling context decoding method and apparatus
Publication Date: 2025.12.24 HUAWEI TECH CO LTD
  • EP4290372B1 patent drawingFigure 1~2
  • EP4290372B1 patent drawingFigure 3(a)~3(b)
  • EP4290372B1 patent drawingFigure 4

AI summary

This application provides an encoding method and a decoding method for a function calling context, and an apparatus. The encoding method includes: obtaining encoding values corresponding to creation relationships between a plurality of threads in program code, and obtaining, based on the encoding values corresponding to the creation relationships between the plurality of threads and calling context information of a target function, an encoding result of a context of a thread to which the target function belongs. According to the method in this application, the encoding result of the context of the thread to which the target function belongs can be obtained, so that different calling contexts of functions in a plurality of threads can be distinguished. This helps improve analysis efficiency and analysis precision.