0

Is branch history preserved across function calls or does it get re-initialized every time the function is entered.

san
  • 4,144
  • 6
  • 32
  • 50
  • A processor doesn't know anything about function calls. It only knows about addresses where jump and call instructions once executed. Nothing is being reset when you make a function call in a C program. – Hans Passant Mar 28 '14 at 22:10
  • @HansPassant Thanks for the info. I associate a function call with a jump, unless its inlined. Glad to know history is maintained across jumps. – san Mar 28 '14 at 22:24
  • 1
    The processor does see calls, but there's no reason to reset the history everytime you enter - it would make a horrible predictor without this history. Just think of `while (!finished()) { ...` – Leeor Mar 29 '14 at 14:51

0 Answers0