All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Zaffiro <davzaffiro@netscape.net>
To: vda@port.imtp.ilyichevsk.odessa.ua
Cc: willy@w.ods.org, linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Compiling x86 with and without frame pointer
Date: Mon, 25 Nov 2002 12:57:04 +0100	[thread overview]
Message-ID: <3DE21010.9050407@netscape.net> (raw)
In-Reply-To: 200211251009.gAPA9np09476@Port.imtp.ilyichevsk.odessa.ua

>>since "-momit-leaf-frame-pointer" makes a trade-off between both
>>other options: it omits framepointers for leaf functions (callees
>>that aren't callers as well) and it doesn't for branch-functions.
> 
> 
> Which does not sound quite right for me. FP should be omitted
> only if function contains less than half dozen stack references,
> otherwise not. It does not matter whether it is a leaf function or not.

Leaf functions generally do not contain more than half dozen 
stackreferences, and are generally called more or equally often as there 
callers. The slight overhead of leaf functions that do contain a dozen 
stackreferences is much smaller than the overhead of omitting 
framepointers in /all/ branch functions including those with dozens of 
stackreferences. Maybe gcc's optimizer could be adapted in the (near) 
future to compare either speed or sizes of possibly generated code, with 
and without framepointer, if the compile is not a debug one.

But in the mean time, in most "userland" projects I've tested with, the 
-momit-leaf-frame-pointer resulted in almost te same codesize as 
compiles with framepointer, along with more or less the same speed as 
"-fomit-frame-pointer". I wouldn't know how to benchmark kernel-configs 
though, and I haven't seen anyone doing this with the framepointer 
options yet...


> OTOH, AFAIK frame pointers make debugging easier, development kernels
> are better to be compiled with fp in every func.

Honestly, I think that's a shortcoming of the debugger if that's true. 
The debugger could store the stackpointer position after a call or 
calculate it based on sub/add/push/pop's, instead of borrowing it from 
ebp.  I'm just concerned about the extra costs (in speed and size) of 
always omiting the framepointer.

(It shouldn't be impossible to debug regparm- and stdcall-functions as 
well, I wonder why this could be a problem at the moment. But just 
"omitting framepointers" at least doesn't mix up the (IMHO: somewhat 
thoughtlessly defined) i386 32-bit C-callingconvention.)


  reply	other threads:[~2002-11-25 11:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-21  4:47 Compiling x86 with and without frame pointer Keith Owens
2002-11-21  5:06 ` Mark Mielke
2002-11-21  9:30   ` David Zaffiro
2002-11-21 19:20     ` Willy Tarreau
2002-11-21 19:32       ` Doug Ledford
2002-11-21 19:41         ` Willy Tarreau
2002-11-21 20:00           ` Doug Ledford
2002-11-25  8:47       ` David Zaffiro
2002-11-25  8:52         ` Willy Tarreau
2002-11-25 14:55           ` Denis Vlasenko
2002-11-25 15:00         ` Denis Vlasenko
2002-11-25 11:57           ` David Zaffiro [this message]
2002-11-21 12:55 ` Dave Jones
2002-11-21 14:46   ` Alan Cox
2002-11-21 17:44 ` Martin J. Bligh
2002-11-21 23:47   ` Rudmer van Dijk
2002-11-25  8:59   ` David Zaffiro

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=3DE21010.9050407@netscape.net \
    --to=davzaffiro@netscape.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vda@port.imtp.ilyichevsk.odessa.ua \
    --cc=willy@w.ods.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.