4 ms·
A function with an unlikely slowpath can easily end up arranged as top part jxx slow fast middle part end: bottom part ret slow: sl
by mananaysiempre 2y ago
A function with an unlikely slowpath can easily end up arranged as
top part
jxx slow
fast middle part
end:
bottom part
ret
slow:
slow middle part
jmp end
There may be more than one slow part, the slow parts might actually be exiled from inside a loop and not a simple linear code path and can themselves contain loops, etc. Play with __builtin_expect and objdump --visualize-jumps a bit and you’ll encounter many variations.