This is the mail archive of the
libffi-discuss@sourceware.org
mailing list for the libffi project.
Re: [PATCH] Go closures for s390[x]
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: rth at redhat dot com (Richard Henderson)
- Cc: libffi-discuss at sourceware dot org, Ulrich dot Weigand at de dot ibm dot com (Ulrich Weigand), krebbel at linux dot vnet dot ibm dot com (Andreas Krebbel)
- Date: Fri, 19 Dec 2014 14:13:36 +0100 (CET)
- Subject: Re: [PATCH] Go closures for s390[x]
- Authentication-results: sourceware.org; auth=none
Richard Henderson wrote:
> On 12/16/2014 09:05 AM, Dominik Vogt wrote:
> > lm %r6,%r15,48+24(%r11)
> > + .cfi_remember_state
> > + .cfi_restore 15
> > + .cfi_restore 14
> > + .cfi_restore 13
> > + .cfi_restore 12
> > + .cfi_restore 11
> > + .cfi_restore 10
> > + .cfi_restore 9
> > + .cfi_restore 8
> > + .cfi_restore 7
> > + .cfi_restore 6
> > + .cfi_def_cfa r15, 96
> > br %r4
> > + .cfi_restore_state
> > + # This nopr is necessary so that the .cfi instructions between the br
> > + # above and the label below get executed. See execute_cfa_program() in
> > + # the Gcc source code, libgcc/unwind-dw2.c.
> > + nopr
>
> I'm not really sure you need any of these restores, since the data is still on
> the stack, unclobbered. I think you'd really only need to reset the cfa here.
Ah, right. The GPRs are saved in the 96/160-byte bias area, which is not
clobbered even by signal handlers. (I guess GCC could also do that same
optimization when creating CFI for epilogues ...)
It looks like we do need the restore of r15, though, otherwise the CFA
compuation will be wrong.
> The nopr seems like a red herring. I don't see why the < vs <= for
> execute_cfa_program is relevant -- this is not following a call.
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.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com