|
|
Log in / Subscribe / Register

Relief for retpoline pain

Relief for retpoline pain

Posted Dec 15, 2018 5:52 UTC (Sat) by josh (subscriber, #17465)
Parent article: Relief for retpoline pain

There are other good reasons to optimize indirect calls into direct ones. If you can figure out what code can and can't be called by a function pointer, you could optimize out the code that can't be called, and even inline the only possible code in a given kernel configuration.


to post comments

Relief for retpoline pain

Posted Dec 18, 2018 11:59 UTC (Tue) by jezuch (subscriber, #52988) [Link]

In compilers this is called devirtualization and recent GCC versions can do this automatically for C++ at least. Java's JIT does this too and it's one of the biggest advantages of JIT over AOT as it knows for real what can and cannot be called and what is the distribution of probabilities of targets. A very smart compiler could in theory recognize the pattern in C and optimize it too, but since this is not a concept of the language itself, I wouldn't count on it really.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds