Claims
- 1. In a compiler, a method of generating assembly code to aid in stack unwinding of a memory stack, the method comprising:
obtaining one or more source code lines; and generating assembly code for the one or more source code lines, the assembly code including one or more stack unwind assembler directives, each of the stack unwind assembler directives having one or more associated stack unwind sub directives, each of the stack unwind assembler directives being adapted for indicating to an assembler that one or more encoded data sections containing information to be used during stack unwinding is to be generated from the one or more associated stack unwind sub directives.
- 2. The method as recited in claim 1, wherein each stack unwind sub directive indicates a stack unwind operation to be performed.
- 3. The method as recited in claim 1, wherein each stack unwind sub directive indicates a previously performed stack operation for which unwinding is to be performed.
- 4. The method as recited in claim 1, wherein each stack unwind sub directive indicates one or more stack operations that are to be reversed by a stack unwind mechanism using the one or more encoded data sections.
- 5. Assembly code generated according to the method of claim 1.
- 6. In a compiler, a method of generating assembly code to aid stack unwinding of a memory stack, the method comprising:
obtaining one or more source code lines; and generating from the one or more source code lines a stack unwind assembler directive and an associated stack unwind sub directive, wherein the stack unwind assembler directive indicates that one or more encoded data sections containing stack information to be used for stack unwinding of the stack is to be generated by an assembler from the stack unwind sub directive.
- 7. In a compiler, a method of generating assembly code to aid stack unwinding from a set of source code, the method comprising:
generating a stack unwind assembler directive; and generating a stack unwind sub directive, wherein the stack unwind assembler directive indicates that one or more encoded data sections containing stack information to be used for unwinding of a stack is to be generated by an assembler from the stack unwind sub directive.
- 8. The method as recited in claim 7, wherein the stack unwind sub directive indicates a region operation designating one or more portions of a function.
- 9. The method as recited in claim 8, wherein the region operation designates a prologue region of a function or a body region of a function.
- 10. The method as recited in claim 7, wherein the stack unwind sub directive indicates which registers have been saved prior to a function call.
- 11. The method as recited in claim 7, wherein the stack unwind sub directive indicates whether the stack has a fixed size or a variable size.
- 12. The method as recited in claim 7, wherein the stack unwind sub directive indicates a number of entries in the stack.
- 13. The method as recited in claim 7, wherein the stack unwind sub directive indicates whether a function being called has a fixed number of arguments or a variable number of arguments.
- 14. The method as recited in claim 11, wherein when the stack has a variable size, the stack unwind sub directive further indicates that a stack pointer is saved.
- 15. The method as recited in claim 11, wherein when the stack has a variable size, the stack unwind sub directive further indicates that a stack pointer is restored.
- 16. The method as recited in claim 7, wherein the stack unwind sub directive indicates a source register from which data is to be obtained.
- 17. The method as recited in claim 16, wherein the stack unwind sub directive further indicates a destination register or destination memory location to which the obtained data is to be saved.
- 18. The method as recited in claim 17, wherein the destination memory location is indicated through an offset from a stack pointer or previous stack pointer.
- 19. The method as recited in claim 7, wherein the stack unwind sub directive indicates a memory location or first register to which contents of a second register is to be spilled.
- 20. The method as recited in claim 19, wherein the memory location is specified relative to a stack pointer or previous stack pointer.
- 21. The method as recited in claim 19, wherein the second register is of type branch, floating point, or general purpose.
- 22. The method as recited in claim 19, wherein the stack unwind sub directive indicates multiple destination registers to which contents of one or more source registers are to be spilled.
- 23. A computer-readable medium for generating assembly code for stack unwinding of a memory stack, comprising:
instructions for obtaining one or more source code lines; and instructions for generating from the one or more source code lines a stack unwind assembler directive and an associated stack unwind sub directive, wherein the stack unwind assembler directive indicates that one or more encoded data sections containing information to be accessed during stack unwinding of the stack is to be generated by an assembler from the stack unwind sub directive.
- 24. An apparatus for generating assembly code for stack unwinding of a memory stack, comprising:
a processor; and a memory, at least one of the processor and the memory being adapted for: obtaining one or more source code lines; and generating from the one or more source code lines a stack unwind assembler directive and an associated stack unwind sub directive, wherein the stack unwind assembler directive indicates that one or more encoded data sections containing stack information to be used to perform stack unwinding of the stack is to be generated by an assembler from the stack unwind sub directive.
- 25. An apparatus for generating assembly code for stack unwinding of a memory stack, comprising:
means for obtaining one or more source code lines; and means for generating from the one or more source code lines a stack unwind assembler directive and an associated stack unwind sub directive, wherein the stack unwind assembler directive indicates that one or more encoded data sections containing information to be used for stack unwinding of the stack is to be generated by an assembler from the stack unwind sub directive.
- 26. In an assembler, a method of generating object code from assembler stack unwind directives, the method comprising:
receiving a stack unwind assembler directive having one or more associated stack unwind sub directives, wherein the stack unwind assembler directive indicates to the assembler that one or more encoded data sections containing information for implementing stack unwinding is to be generated from the one or more associated stack unwind sub directives; and generating one or more encoded data sections containing stack information to implement a stack unwind feature designated by the one or more stack unwind sub directives.
- 27. The method as recited in claim 26, wherein generating one or more encoded data sections containing information to implement the stack unwind feature designated by the one or more stack unwind sub directives comprises:
generating one or more encoded data sections containing information to reverse stack operations previously performed as indicated by the one or more stack unwind sub directives.
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] This application claims priority of U.S. Provisional Application No. 60/291,420, entitled “Methods and Apparatus for Use in Aiding Stack Unwinding,” filed on May 16, 2001, which is hereby incorporated by reference for all purposes.
Provisional Applications (1)
|
Number |
Date |
Country |
|
60291420 |
May 2001 |
US |