public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug objc/101616] New: Objective-C frontend should not emit vtable/fixup messages (at least, not by default)
@ 2021-07-25  4:22 mhjacobson at me dot com
  2021-07-25  6:39 ` [Bug objc/101616] " egallager at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mhjacobson at me dot com @ 2021-07-25  4:22 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-29  9:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-25  4:22 [Bug objc/101616] New: Objective-C frontend should not emit vtable/fixup messages (at least, not by default) mhjacobson at me dot com
2021-07-25  6:39 ` [Bug objc/101616] " egallager at gcc dot gnu.org
2021-07-25  7:28 ` iains at gcc dot gnu.org
2021-07-29  2:55 ` mhjacobson at me dot com
2021-07-29  9:33 ` iains at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).