[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160524222156.GA7963@fergus.ozlabs.ibm.com>
Date: Wed, 25 May 2016 08:21:56 +1000
From: Paul Mackerras <paulus@...abs.org>
To: Gabriel Paubert <paubert@...m.es>
Cc: Christophe Leroy <christophe.leroy@....fr>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Michael Ellerman <mpe@...erman.id.au>,
Scott Wood <oss@...error.net>, linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] powerpc: inline current_stack_pointer()
On Mon, May 23, 2016 at 07:17:38PM +0200, Gabriel Paubert wrote:
> On Mon, May 23, 2016 at 10:46:02AM +0200, Christophe Leroy wrote:
> > current_stack_pointeur() is a single instruction function. it
> > It is not worth breaking the execution flow with a bl/blr for a
> > single instruction
>
> Are you sure that the result is always the same?
>
> Calling an external function prevents the compiler from considering the
> caller of of current_stack_pointer a leaf function, which certainly
> does not help the compiler, but in a leaf function the compiler is free
> not to establish a new frame.
>
> If the compiler decides to establishes a new frame (typically with
> "stwu r1,-frame_size(r1)"), *r1 is the previous stack pointer, or
> the caller's stack pointer, or the current function frame pointer if
> I remember correctly the ABI definitions.
>
> However, if the compiler decides that it can get away without a frame
> for the function, *r1 is the stack pointer of the caller's caller.
>
> Depending on the application, this may or may not be important.
Right. I think I wrote the original current_stack_pointer()
implementation, and that I deliberately didn't make it an inline
so that the caller would have to establish its own stack frame,
and thus its stack pointer value would be a well-defined thing.
Paul.
Powered by blists - more mailing lists