https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101616
Bug ID: 101616 Summary: Objective-C frontend should not emit vtable/fixup messages (at least, not by default) Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: objc Assignee: unassigned at gcc dot gnu.org Reporter: mhjacobson at me dot com Target Milestone: --- In 10.2.0, the Objective-C frontend (in NeXT v2 ABI mode) emits "fixup" messages for all message sends. Fixup messages are an abandoned optimization in which the runtime specializes the message send routine to a fast vtable lookup routine for a small set of common selectors. (The set of common selectors is hard-coded in the runtime.) For other selectors, the fixup message simply devolves into a normal message send, albeit with extra pointer chasing. The Apple runtime has not actually supported this optimization since OS X Mountain Lion, as an inspection of the Mountain Lion [0] and Mavericks [1] sources will confirm. (Search for "fixupMessageRef".) The Mavericks-and-later runtimes still *deal* with fixup messages, but all callsites are treated as non-optimized selectors. Clang appears to have stopped emitting fixup messages around 2010. Furthermore, even when Clang *did* use fixup messages, it did so only for a small set of selectors (that presumably tended to match the ones optimized by the runtime). By contrast, GCC simply uses them for all messages. GCC should probably just stop emitting fixup messages calls entirely, but at least it should only do so behind some driver flag. [0] https://opensource.apple.com/source/objc4/objc4-532/runtime/objc-runtime-new.mm.auto.html [1] https://opensource.apple.com/source/objc4/objc4-551.1/runtime/objc-runtime-new.mm.auto.html