public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mhjacobson at me dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug objc/101616] New: Objective-C frontend should not emit vtable/fixup messages (at least, not by default)
Date: Sun, 25 Jul 2021 04:22:52 +0000	[thread overview]
Message-ID: <bug-101616-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2021-07-25  4:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-25  4:22 mhjacobson at me dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101616-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).