One embodiment of the present invention provides a system which
selectively executes deferred instructions following a return of a
long-latency operation in a processor that supports
speculative-execution. During normal-execution mode, the processor issues
instructions for execution in program order. When the processor
encounters a long-latency operation, such as a load miss, the processor
records the long-latency operation in a long-latency scoreboard, wherein
each entry in the long-latency scoreboard includes a deferred buffer
start index. Upon encountering an unresolved data dependency during
execution of an instruction, the processor performs a checkpointing
operation and executes subsequent instructions in an execute-ahead mode,
wherein instructions that cannot be executed because of the unresolved
data dependency are deferred into a deferred buffer, and wherein other
non-deferred instructions are executed in program order. Upon
encountering a deferred instruction that depends on a long-latency
operation within the long-latency scoreboard, the processor updates a
deferred buffer start index associated with the long-latency operation to
point to position in the deferred buffer occupied by the deferred
instruction. When a long-latency operation returns, the processor
executes instructions in the deferred buffer starting at the deferred
buffer start index for the returning long-latency operation.