Patent ID: 7971044
Filing Date: 2011-06-28
Classification: G06F

Abstract:
1. A method of managing a link stack comprising a plurality of entries, each entry operative to store a link address, the method comprising: predicting a branch evaluation of a branch instruction; in response to the prediction, speculatively executing instructions; saving a prior value of a link stack entry in a link stack restore buffer in response to determining that the speculative instruction will write to the link stack, wherein the link stack restore buffer is separate from the link stack; speculatively writing a first link address associated with the speculative instruction to the link stack entry, wherein the prior value of the link stack entry is overwritten; detecting that the branch evaluation was mispredicted; detecting that the link stack was speculatively written; and restoring the saved prior value from the link stack restore buffer to the link stack; wherein detecting that the link stack was speculatively written comprises: maintaining a first count of a total number of uncommitted link stack write instructions in a pipeline; maintaining a second count, associated with each uncommitted branch instruction, of the uncommitted link stack write instructions ahead of it in the pipeline; and upon detecting that a branch was mispredicted, comparing the second count to the first count and detecting that the link stack was speculatively written if the first and second counts are not the same.