If you put me in charge of objc_msgSend, I think I’d have the compiler scatter a couple of polymorphic inline caches into the binary at each call site (using indirect jumps to satisfy W^X). I think it’d reduce insn count from 11 to ~6, and it would use the BTB better.
-
-
In fact, now that I think about it, it’d be pretty doable to use PGO to devirtualize Objective-C method calls…
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I bet
@gparker must've tried something along those lines in the past... -
Two problems: One, many call sites really want a two-entry cache (mutable and non-mutable class, for example). Two, it costs too much dirty memory to do this everywhere so you need some way to choose at compile time where to apply it.
- 12 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.