From: David Mosberger <davidm@hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] Unwind problem for __attribute__ noreturn
Date: Wed, 21 Mar 2001 19:13:15 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590693005321@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590693005303@msgid-missing>
>>>>> On Wed, 21 Mar 2001 10:48:54 -0800, Cary Coutant <cary@cup.hp.com> said:
>> Anyhow, I'll re-read the unwind conventions when I'm back at
>> work. Either the document answers this question unambigiously
>> and one of the existing unwinder implementation is wrong, or it
>> doesn't answer the question, in which case we need to pick one
>> solution and work towards clarifying this point in the manual.
Cary> I'll admit up front that the unwind conventions do not answer
Cary> this question explictly, and they should.
OK.
Cary> The unwind conventions, however, are built on the assumption
Cary> that the return pointer can always be used to determine the
Cary> unwind state of the caller, whether that return pointer was
Cary> generated by a br.call instruction, or through some equivalent
Cary> assembly code.
Yes, that was certainly my _impression_ when reading the unwind
conventions. It would be good to make this explicit, though.
Cary> Anyone using an assembly coding trick to make the return go
Cary> somewhere other than immediately after the call must bear the
Cary> responsibility of ensuring that the unwind information is
Cary> correct.
Yes, the kernel does that.
Cary> In the case of a call to a "noreturn" procedure, I'll offer
Cary> the opinion that having the unwinder decrement the rp is not
Cary> correct. Two solutions immediately come to mind:
Cary> 1. Emit a bundle of nops following the call. I understand that
Cary> this is at odds with the goal of being able to describe
Cary> fully-optimized code, but it seems like a rare enough case and
Cary> a small enough penalty that we could live with it.
OK. But I'd rather see the compiler emit a "break 0" instead of a
"nop 0". With the former, when a noreturn function unexpectedly
returns, it will a generate a SIGILL signal with code ILL_ILLOPC
(illegal opcode) instead of silently executing wrong code.
Cary> 2. Turn the call into a tail call. Thus, in a call chain A
Cary> calls B calls C, where C is the noreturn procedure, B would
Cary> instead branch to C, making it look like A called C. You have
Cary> to deallocate B's memory stack frame, so the bundle of nops
Cary> may actually be more attractive unless B doesn't actually have
Cary> a memory stack frame -- but it's also possible that the
Cary> deallocation could be accomplished in spare instruction
Cary> slots. C would simply take over B's register stack frame. As
Cary> noted in the runtime document, tail calls can be done only
Cary> when all arguments are in registers.
Yes, I considered that, too. But I think the biggest savings of
"noreturn" comes precisely from not having to bother to drop the
current call frame, so emitting an extra bundle containing "break 0"
is probably a better approach.
--david
next prev parent reply other threads:[~2001-03-21 19:13 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-20 2:10 [Linux-ia64] Unwind problem for __attribute__ noreturn Keith Owens
2001-03-21 0:24 ` Jim Wilson
2001-03-21 6:03 ` Keith Owens
2001-03-21 6:53 ` David Mosberger
2001-03-21 7:12 ` Jim Wilson
2001-03-21 7:54 ` David Mosberger
2001-03-21 8:54 ` Keith Owens
2001-03-21 17:54 ` David Mosberger
2001-03-21 18:48 ` Cary Coutant
2001-03-21 19:07 ` Jim Wilson
2001-03-21 19:13 ` David Mosberger [this message]
2001-03-21 19:13 ` Jim Wilson
2001-03-21 19:26 ` Cary Coutant
2001-03-21 19:40 ` Jim Wilson
2001-03-21 19:58 ` David Mosberger
2001-03-21 20:00 ` Jim Wilson
2001-03-21 20:38 ` Jim Wilson
2001-03-21 22:54 ` David Mosberger
2001-03-21 23:42 ` Cary Coutant
2001-03-22 17:00 ` Rich Altmaier
2001-03-23 20:28 ` Jim Wilson
2001-03-24 0:58 ` Cary Coutant
2001-03-24 1:27 ` Keith Owens
2001-03-24 1:37 ` Jim Wilson
2001-03-26 22:06 ` DE-DINECHIN,CHRISTOPHE (HP-Cupertino,ex1)
2001-03-26 22:58 ` Cary Coutant
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=marc-linux-ia64-105590693005321@msgid-missing \
--to=davidm@hpl.hp.com \
--cc=linux-ia64@vger.kernel.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