Avoiding retpolines with static calls
Avoiding retpolines with static calls
Posted Mar 27, 2020 7:36 UTC (Fri) by josh (subscriber, #17465)Parent article: Avoiding retpolines with static calls
(This would also allow eliminating a type of callback entirely if no non-NUL function is ever stored in that function pointer. That could optimize various kinds of function pointers that don't always get used in a given struct of pointers.)
Posted Mar 27, 2020 9:07 UTC (Fri)
by epa (subscriber, #39769)
[Link] (13 responses)
Posted Mar 27, 2020 9:31 UTC (Fri)
by gus3 (guest, #61103)
[Link] (11 responses)
Posted Mar 27, 2020 9:39 UTC (Fri)
by epa (subscriber, #39769)
[Link] (10 responses)
Posted Mar 28, 2020 10:41 UTC (Sat)
by ncm (guest, #165)
[Link] (9 responses)
Fetishism around object-oriented conventions is worse than pointless. Virtual calling is a language mechanism that has various uses, implementing polymorphic runtime binding being one among them.
Sometimes virtual calls perform better than calling through a function pointer, because there is less choice. But sometimes the function pointer call is faster, particularly if the pointer rarely or never changes. On modern cores, both are hardly slower than a direct call except in pathological cases.
A virtual call, by offering fewer choices for what could happen, is often easier for a reader to understand than a call through a function pointer. So, it is often a good idea to cobble up a base class just to provide a virtual call, even where there is logically no meaningful object involved. Having cobbled one up, though, it often becomes useful to park things there. Having parked things there, it may be worth formalizing a class with invariants. Or it might not.
Posted Mar 28, 2020 19:12 UTC (Sat)
by nivedita76 (subscriber, #121790)
[Link] (8 responses)
Posted Mar 29, 2020 3:18 UTC (Sun)
by ncm (guest, #165)
[Link] (7 responses)
But of course C++ code is hard to get into the kernel. Linus's deliberate choice to use C++ keywords in kernel headers is one barrier to overcome.
Posted Mar 29, 2020 4:06 UTC (Sun)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Posted Mar 29, 2020 10:41 UTC (Sun)
by ballombe (subscriber, #9523)
[Link] (4 responses)
Posted Mar 29, 2020 12:28 UTC (Sun)
by mpr22 (subscriber, #60784)
[Link]
Posted Apr 3, 2020 18:07 UTC (Fri)
by adobriyan (subscriber, #30858)
[Link]
\let foo: u32 = 0;
Posted Apr 4, 2020 17:18 UTC (Sat)
by nix (subscriber, #2304)
[Link] (1 responses)
Posted Apr 6, 2020 15:03 UTC (Mon)
by mathstuf (subscriber, #69389)
[Link]
Posted Mar 29, 2020 15:11 UTC (Sun)
by nivedita76 (subscriber, #121790)
[Link]
Posted Mar 29, 2020 15:07 UTC (Sun)
by nivedita76 (subscriber, #121790)
[Link]
Avoiding retpolines with static calls
Avoiding retpolines with static calls
Avoiding retpolines with static calls
Avoiding retpolines with static calls
Avoiding retpolines with static calls
Avoiding retpolines with static calls
Avoiding retpolines with static calls
Avoiding retpolines with static calls
Stroupstrup deliberate choice to break C compatibility by adding new keyword to C++ is one barrier to overcome.
Avoiding retpolines with static calls
Avoiding retpolines with static calls
Avoiding retpolines with static calls
Avoiding retpolines with static calls
Avoiding retpolines with static calls
Avoiding retpolines with static calls