all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: Emacs-diffs Digest, Vol 94, Issue 89
Date: Sat, 25 Sep 2010 09:50:05 +0200	[thread overview]
Message-ID: <87tylexnwy.fsf@lola.goethe.zz> (raw)
In-Reply-To: 83k4mas2s5.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> From: David Kastrup <dak@gnu.org>
>> Date: Fri, 24 Sep 2010 22:29:02 +0200
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> > Or maybe you mean that Stefan thought casting was not the best idea.
>> > In that case, I'd like Stefan's opinion on this one:
>> >
>> >> -  int frame_lines = FRAME_LINES (frame);
>> >> +  EMACS_INT frame_lines = FRAME_LINES (frame);
>> >
>> > I think down that lane lies madness, because we have lots of struct
>> > members that are Lisp integers, and assigning the result of XINT of
>> > every one of them to an EMACS_INT will significantly and unnecessarily
>> > increase our stack usage (on 64-bit machines).
>> 
>> "Significantly"?  Reality check.
>
> Yes, indeed.  Take a look at GC some day, it uses up tens of thousands
> of recursive calls as a matter of routine.

And how many of those garbage collection calls are involved in this
particular issue?  About zero I should guess.

> And even without GC, there are about 30 frames on the stack any time I
> debug Emacs.

Of which there are, pessimistically speaking, probably 10 affected.  So
we are talking about several dozens of wasted bytes at any given point
of time.  Very much dwarved by the stack requirements of garbage
collection, according to you.

> If we pacify -Wconversion by using EMACS_INT for every variable that
> sometimes gets assigned the result of XINT or XFASTINT, that could be
> quite a lot of memory waste.

We are talking about automatic variables here.  When optimizing, the
compiler does not even reserve stack space when it does not need it.  In
fact, you are likely getting code bloat if you force intermediate values
into variables of smaller size than the original type.  The compiler
works with 64-bit registers in the affected architectures, anyway, and
it needs to fiddle with masking/extending operations in order to
simulate 32-bit variables.  It generates extra code in order to produce
the behavior that the compiler warns about.

-- 
David Kastrup




  reply	other threads:[~2010-09-25  7:50 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1OzCq2-00008v-RR@eggs.gnu.org>
2010-09-24 19:00 ` Emacs-diffs Digest, Vol 94, Issue 89 Eli Zaretskii
2010-09-24 19:41   ` Lars Magne Ingebrigtsen
2010-09-24 19:50     ` Eli Zaretskii
2010-09-24 20:19       ` Eli Zaretskii
2010-09-24 20:29         ` David Kastrup
2010-09-25  7:25           ` Eli Zaretskii
2010-09-25  7:50             ` David Kastrup [this message]
2010-09-24 22:08         ` Chong Yidong
2010-09-25 20:05           ` Stefan Monnier
2010-09-24 22:25   ` Stefan Monnier
2010-09-25  7:31     ` Eli Zaretskii
2010-09-25 13:19       ` Lars Magne Ingebrigtsen
2010-09-25 13:28         ` Eli Zaretskii
2010-09-25 20:09       ` Stefan Monnier
2010-09-25 20:30         ` Lars Magne Ingebrigtsen
2010-09-25 22:09           ` Eli Zaretskii
2010-09-26 21:52             ` Stefan Monnier
2010-09-27 15:33               ` Chong Yidong
2010-09-27 16:23                 ` Lars Magne Ingebrigtsen
2010-09-27 20:59                   ` Stefan Monnier
2010-09-27 21:10                     ` Lars Magne Ingebrigtsen
2010-09-27 21:21                       ` Andreas Schwab
2010-09-28  5:47                         ` Eli Zaretskii
2010-09-28  9:26                           ` Lars Magne Ingebrigtsen
2010-09-28 22:35                             ` Stefan Monnier
2010-09-29 13:15                           ` Davis Herring

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=87tylexnwy.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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.