Exception handling utilizing call instruction with context information
AssigneeAxis AB
InventorHans-Peter Nilsson
Life of this patent
Estimating the term…
Abstract
In-code context data used for exception handling is incorporated into a special call instruction which is recognized by the processor. The information is skipped at the time of the function call and read at the time of the stack unwinding. This special call instruction may be implemented to run at no extra cycle costs compared to normal instructions, except for the external execution time dependencies from such machinery as a cache involved in the instruction fetching, since it would never be necessary during normal execution to actually access the information. The information is only accessed during exception handling.
Claims19
A data processing system responsive to instructions in program code to execute a process and the instructions including call points between caller and called instructions and instructions for maintaining a stack, and the data processing system comprising:
- instruction fetch logic which fetches the instructions in the program code to provide a sequence of instructions in response to an instruction pointer, the instructions further including first jump instructions with a jump address and second jump instructions with a jump address together with context information for a portion of the stack associated with the corresponding call point;
- instruction decode logic, coupled to the instruction fetch logic, which decodes a current instruction in the sequence for execution, and including logic to detect the first and second jump instructions and to skip decoding the context information of the second jump instructions;
- execution resources, coupled to the instruction decode logic, which execute the decoded instructions;
- logic, coupled with the instruction fetch logic, which updates the instruction pointer;
- and
- an exception manager to handle exceptions generated by execution of the corresponding called function by accessing the context information of at least an associated one of the second jump instructions to unwind the stack.
A method for processing instructions in program code in a data processing system and the instructions including call points between caller and called instructions and instructions for maintaining a stack, and the method for processing comprising the acts of:
- storing instructions in program code in addressable memory, the instructions including first jump instructions with a jump address and second jump instructions with a jump address together with context information for a portion of the stack associated with the corresponding call point;
- fetching a sequence of instructions from the memory in response to an instruction pointer identifying an address in the addressable memory;
- decoding a current instruction in the sequence, including detecting the first and second jump instructions and skipping decoding the context information of the second jump instructions;
- updating the instruction pointer by a length of the current instruction;
- calling an exception manager if conditions for the exception are met;
- and in response to calling the exception manager, reading the context information of at least an associated one of the second jump instructions at an address in the addressable memory determined in response to a function of the instruction pointer to unwind the stack.
A development system to generate program code from source code and to execute the program code, and the development system comprising:
- a compiler-linker for generating the program code from source code and the compiler-linker for inserting a first jump instruction with an argument at the call-point of a calling function to a called function which does not throw exceptions and for inserting a second jump instruction with both an argument together with corresponding context information at each call-point to called functions which can throw exceptions and said compiler-linker further for generating instructions to maintain a stack;
- logic for executing the program code including the arguments of the first and the second jump instructions and for avoiding the execution of the context information of the second jump instructions during normal processing;
- and
- an exception manager to handle the throwing of exceptions by the corresponding called function by accessing the context information of the associated second jump instruction to determine the layout of an associated portion of the stack thereby to unwind the associated portion of the stack.
Dependencies are inferred from the claim text.