public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: rth@redhat.com (Richard Henderson)
Cc: libffi-discuss@sourceware.org,
	Ulrich.Weigand@de.ibm.com (Ulrich Weigand),
	       krebbel@linux.vnet.ibm.com (Andreas Krebbel)
Subject: Re: [PATCH] Go closures for s390[x]
Date: Fri, 19 Dec 2014 14:48:00 -0000	[thread overview]
Message-ID: <201412191448.sBJEmeUw027195@d03av02.boulder.ibm.com> (raw)
In-Reply-To: <549431B0.10806@redhat.com> from "Richard Henderson" at Dec 19, 2014 08:09:52 AM

Richard Henderson wrote:
> On 12/19/2014 07:13 AM, Ulrich Weigand wrote:
> > Actually, it sort-of is; the code does:
> >         la      %r14,0(%r13,%r9)                # Set return address
> >         br      %r7                             # ... and call function
> > 
> > i.e. sets the return address register to point to one of the return stubs
> > and then jumps to the target function instead of calling it; so from the
> > point of view of an unwinder, it looks like the target function was called
> > from the instruction immediately preceding the return stub.
> 
> Ah, good point.  That's the sort of verbage that should be in the comment then.
> 
> Is that optimization really worth it?  Is there no call/return prediction stack
> to get confused?  I know I replicated it in the code that I wrote, but really
> only now do I start to question it.

There's no call/return stack as such on current processors; we don't have
hard-coded call/return instructions, and the various OSes on the platform
use registers in quite different ways as part of their calling conventions.

However, I agree that in general it's probably best to avoid tricks like that.


-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

  reply	other threads:[~2014-12-19 14:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16 15:05 Dominik Vogt
2014-12-18 21:29 ` Richard Henderson
2014-12-19 13:13   ` Ulrich Weigand
2014-12-19 14:10     ` Richard Henderson
2014-12-19 14:48       ` Ulrich Weigand [this message]
2014-12-22 10:27   ` Dominik Vogt
2014-12-22 16:31     ` Richard Henderson

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=201412191448.sBJEmeUw027195@d03av02.boulder.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=krebbel@linux.vnet.ibm.com \
    --cc=libffi-discuss@sourceware.org \
    --cc=rth@redhat.com \
    /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).