0

I was wondering about this. Branch predictors I think generally can handle binary indirect branches -- where there are two immediately visible possible paths the branch could take. However, I was thinking, are branch predictors able to predict indirect function calls, like a virtual function call in C++? Say, if a certain indirect function call at a certain place in the program calls one function 99% or even 100% of the time, does that get recorded and optimized by the branch predictor? I'm asking about architectures in general, but mostly interested in x86 and x86-64.

1201ProgramAlarm
  • 32,384
  • 7
  • 42
  • 56
Anonymous1847
  • 2,568
  • 10
  • 16
  • Look up the difference between _branch predictor_ and _branch target predictor_. – Mike Vine Nov 08 '20 at 21:34
  • Perhaps https://stackoverflow.com/questions/7241922/how-has-cpu-architecture-evolution-affected-virtual-function-call-performance is helpful. – Morty Nov 08 '20 at 21:34

0 Answers0