Overview

Function calls are a specific type of branch. When a function is called, the return address is pushed onto a stack. The RSB is a hardware implementation of this stack within the CPU.

Mechanism

  • On Call: The CPU pushes the return address onto the RSB.
  • On Return: The CPU pops the address from the RSB to predict where to jump back to.

Accuracy

Because function calls and returns are usually perfectly matched, the RSB is one of the most accurate predictors in a modern CPU. However, it can be 'corrupted' by deep recursion or complex control flow that exceeds its size.