3/6/2026 at 1:17:58 PM
> Your CPU doesn’t know or care what functions are [...]Well, most architectures do not use plain jumps with implicit arguments for function calls, but have explicit call/ret or branch-with-link instructions. Even those that used jumps had branch hints. The reason is that the microarchitecture must know about call/ret pairs to be able to predict the return path as the generic dynamic predictor is just not good enough for such a common path.
Reduced prediction performance compared normal calls is actually a concern for some coroutine and async code.
> in C we don’t have any dynamic lookup inside functions—every dynamic jump comes from an explicit conditional statement
function pointers.
by gpderetta
3/6/2026 at 1:53:36 PM
> Well, most architectures do not use plain jumps with implicit arguments for function calls, but have explicit call/ret or branch-with-link instructions.Anyone who wants to go deeper on this would be well served doing some reading on "return oriented programming" and shadow stacks / control flow integrity. I got turned onto this by a few LWN articles that talk about the subject (https://lwn.net/Articles/940403/ among others).
It turns out that "jump to this pointer" is actually a dangerous construct, and it's not something you get much high-level exposure to since functions as an abstraction are so unleaky.
by adamnew123456