Patent ID: 9652240
Date: 2017-05-16
CPC Classifications: G06F

Claim:
1. A method of predicting stack pointer values for a stack in a processor, the stack having an associated stack pointer, the method comprising: in response to detection of an instruction growing the stack, storing a data entry in a data structure different from the stack using at least one processor, the data entry comprising a size value corresponding to an amount by which the instruction grows the stack and at least one of: a register ID of a physical register storing a value of the stack pointer prior to the instruction growing the stack; and the value of the stack pointer prior to the instruction growing the stack; and in response to subsequent detection of an instruction shrinking the stack, comparing a size value corresponding to an amount by which the instruction shrinks the stack to the stored size value in the data structure; in response to detecting a correspondence between the size value corresponding to an amount by which the instruction shrinks the stack and the stored size value in the data structure, updating the stack pointer based on at least one of the register ID and the value of the stack pointer in the data entry comprising the stored size value used in the comparison and removing from the data structure the data entry comprising the stored size value used in the comparison; and in response to failing to detect a correspondence between the size value corresponding to an amount by which the instruction shrinks the stack and the stored size value, removing the data entry from the data structure.