Unwinding Unwindable Code via Context Frames
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing unwinding mechanisms are unable to traverse call stacks that contain a mix of annotated and non-annotated code, as they rely on information outside the call stack and cannot proceed when encountering non-annotated stack frames.
Innovation Solution
Inserting a context frame between annotated and non-annotated functions, and an unwind thunk between non-annotated functions, allowing the unwinding process to redirect and continue across non-annotated code by treating the combination as an annotated function.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If unwinding mechanisms use information outside the call stack (annotations) for unwinding, then unwinding can proceed through annotated code, but unwinding cannot proceed when encountering non-annotated stack frames
Solution Approach 1:
The patent introduces context frames as intermediary structures between annotated and non-annotated code. These context frames contain the annotation information that would otherwise be lost when calling non-annotated functions, allowing the unwinder to continue traversal by using the stored context information as a mediator to bridge the gap between annotated and non-annotated code regions.
Solution Approach 2:
The patent performs preliminary actions by saving the current annotated function's context information into a context frame before calling a non-annotated function. This preliminary storage of unwind information ensures that when the non-annotated function returns, the unwinder can resume traversal using the pre-saved context, rather than attempting to retrieve information that no longer exists in the call stack.
2Ease of manufacture
If code is not annotated, then it can be executed freely without additional compilation overhead, but it cannot be unwound by existing mechanisms
Solution Approach 1:
The context frame acts as an intermediary that carries unwind information across the boundary of non-annotated code. The non-annotated code itself remains simple and unmodified, but the context frame inserted around it provides the necessary annotation information for unwinding, thus maintaining execution simplicity while enabling unwind capability.
Solution Approach 2:
The patent creates a copy of the necessary unwind information in the context frame before executing non-annotated code. This copied context information contains the annotation data needed for unwinding, allowing the non-annotated code to execute freely while its unwind capability is supported by the copied information stored in the context frame.
3Reliability
If annotations are added to all code for unwinding, then complete unwinding capability is achieved, but compilation complexity and overhead increase
Solution Approach 1:
The patent applies local quality by adding annotations only where necessary - specifically at the boundaries between annotated and non-annotated code regions. The context frames are inserted selectively around non-annotated functions that are called from annotated code, rather than annotating all code uniformly. This localized approach provides unwind capability where needed while minimizing compilation complexity and overhead.
Data Source
AI summary
Unwinding may take place in an annotated unwinding environment with non-annotated code by placing a context frame between a first annotated function and non-annotated function and an unwind thunk between the non-annotated function and a second annotated function. The unwind thunk may redirect an unwind function to the context frame so that an unwind process may continue across a non-annotated function.


