GNU bug report logs - #11617
Don't use 'register'; these days it's not needed.

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Sun, 3 Jun 2012 06:10:01 UTC

Severity: wishlist

Tags: patch, wontfix

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11617 in the body.
You can then email your comments to 11617 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11617; Package emacs. (Sun, 03 Jun 2012 06:10:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Eggert <eggert <at> cs.ucla.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 03 Jun 2012 06:10:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: Don't use 'register'; these days it's not needed.
Date: Sat, 02 Jun 2012 23:06:11 -0700
[Message part 1 (text/plain, inline)]
Attached is a patch to remove 'register' from the mainline
Emacs source code.  This is broken out of Bug#11604
and I will also follow up there.
[no-register.txt (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11617; Package emacs. (Sun, 03 Jun 2012 14:27:01 GMT) Full text and rfc822 format available.

Message #8 received at 11617 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 11617 <at> debbugs.gnu.org
Subject: Re: bug#11617: Don't use 'register'; these days it's not needed.
Date: Sun, 03 Jun 2012 17:24:24 +0300
> Date: Sat, 02 Jun 2012 23:06:11 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> 
> Attached is a patch to remove 'register' from the mainline
> Emacs source code.

FWIW, I see no compelling reason for this change, even after I've read
the explanations.  This keyword is a cue to the compiler, so it in
general conveys non-trivial information.  If today's compilers mostly
ignore that, it doesn't mean this will always be the state of affairs.
However, by removing this, we lose those cues forever.

I guess I won't be convinced without seeing at least some data about
the disadvantages, and not just a few extreme examples with some
particular versions of some specific compilers.

But this isn't my call, so perhaps you don't need to convince me.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11617; Package emacs. (Sun, 03 Jun 2012 14:53:01 GMT) Full text and rfc822 format available.

Message #11 received at 11617 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Paul Eggert <eggert <at> cs.ucla.edu>, 11617 <at> debbugs.gnu.org
Subject: Re: bug#11617: Don't use 'register'; these days it's not needed.
Date: Sun, 03 Jun 2012 22:50:02 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Attached is a patch to remove 'register' from the mainline
>> Emacs source code.
>
> FWIW, I see no compelling reason for this change, even after I've read
> the explanations.  This keyword is a cue to the compiler, so it in
> general conveys non-trivial information.  If today's compilers mostly
> ignore that, it doesn't mean this will always be the state of affairs.
> However, by removing this, we lose those cues forever.

I wonder how many of those register variables were actually added after
profiling to see if they make any difference.  My guess is none,
i.e. those keywords are bogus.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11617; Package emacs. (Sun, 03 Jun 2012 15:12:02 GMT) Full text and rfc822 format available.

Message #14 received at 11617 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Chong Yidong <cyd <at> gnu.org>
Cc: eggert <at> cs.ucla.edu, 11617 <at> debbugs.gnu.org
Subject: Re: bug#11617: Don't use 'register'; these days it's not needed.
Date: Sun, 03 Jun 2012 18:09:07 +0300
> From: Chong Yidong <cyd <at> gnu.org>
> Cc: Paul Eggert <eggert <at> cs.ucla.edu>,  11617 <at> debbugs.gnu.org
> Date: Sun, 03 Jun 2012 22:50:02 +0800
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> Attached is a patch to remove 'register' from the mainline
> >> Emacs source code.
> >
> > FWIW, I see no compelling reason for this change, even after I've read
> > the explanations.  This keyword is a cue to the compiler, so it in
> > general conveys non-trivial information.  If today's compilers mostly
> > ignore that, it doesn't mean this will always be the state of affairs.
> > However, by removing this, we lose those cues forever.
> 
> I wonder how many of those register variables were actually added after
> profiling to see if they make any difference.  My guess is none,
> i.e. those keywords are bogus.

??? I don't necessarily see the connection between profiling and the
keyword uses.  The way I see it, these are cues to the compiler, they
tell which of the variables are accessed in the inner loops and more
intensively, under the expected data flow.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11617; Package emacs. (Sun, 03 Jun 2012 15:25:01 GMT) Full text and rfc822 format available.

Message #17 received at 11617 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 11617 <at> debbugs.gnu.org
Subject: Re: bug#11617: Don't use 'register'; these days it's not needed.
Date: Sun, 03 Jun 2012 11:22:24 -0400
> Attached is a patch to remove 'register' from the mainline
> Emacs source code.  This is broken out of Bug#11604
> and I will also follow up there.

Please don't bother.  While `register' has been unnecessary for a while
now, I don't see why it would hurt.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11617; Package emacs. (Sun, 03 Jun 2012 16:37:02 GMT) Full text and rfc822 format available.

Message #20 received at 11617 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 11617 <at> debbugs.gnu.org
Subject: Re: bug#11617: Don't use 'register'; these days it's not needed.
Date: Sun, 03 Jun 2012 09:33:45 -0700
On 06/03/2012 08:22 AM, Stefan Monnier wrote:
> While `register' has been unnecessary for a while
> now, I don't see why it would hurt.

It hurts because it wastes developers' time, and has done so
for many years.  It'd be better to not continue to waste our time
worrying about whether to use 'register', or even having to
read the noise word 'register'.  We should definitely not
waste our time reading or maintaining comments like this:

     /* If we use `register' here, gcc-4.0.2 on amd64 using
       -DUSE_LISP_UNION_TYPE complains further down that we're getting the
       address of `force'.  Go figure.  */

This stuff is all bogus and our lives would be a tiny bit simpler
if it vanished.  I've put work into making it vanish, and
I'd appreciate the chance to make that work useful for others.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11617; Package emacs. (Mon, 04 Jun 2012 13:09:01 GMT) Full text and rfc822 format available.

Message #23 received at 11617 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 11617 <at> debbugs.gnu.org
Subject: Re: bug#11617: Don't use 'register'; these days it's not needed.
Date: Mon, 04 Jun 2012 09:06:42 -0400
>> While `register' has been unnecessary for a while
>> now, I don't see why it would hurt.
> It hurts because it wastes developers' time, and has done so
> for many years.

No it doesn't and hasn't.

>      /* If we use `register' here, gcc-4.0.2 on amd64 using
>        -DUSE_LISP_UNION_TYPE complains further down that we're getting the
>        address of `force'.  Go figure.  */

Right, compilers have bugs, and we sometimes bump into them.  If it's
not with "register" it's with something else.

> This stuff is all bogus and our lives would be a tiny bit simpler
> if it vanished.

In my world, the keyword "register" is just another kind of whitespace.
So just like I don't want to install a patch that "cleans up the
whitespace" I'd rather not install your patch.  OTOH, just like for
whitespace, it's perfectly fine for regular patches to remove "register"
in the code they touch.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11617; Package emacs. (Mon, 04 Jun 2012 14:43:03 GMT) Full text and rfc822 format available.

Message #26 received at 11617 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 11617 <at> debbugs.gnu.org
Subject: Re: bug#11617: Don't use 'register'; these days it's not needed.
Date: Mon, 04 Jun 2012 07:40:11 -0700
On 06/04/2012 06:06 AM, Stefan Monnier wrote:
> In my world, the keyword "register" is just another kind of whitespace.

It's a funny kind of whitespace that triggers compiler bugs
and makes code harder to read....  but I take your point and
won't remove 'register' all at once.




Added tag(s) wontfix. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Mon, 04 Jun 2012 16:25:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11617; Package emacs. (Mon, 04 Jun 2012 19:34:02 GMT) Full text and rfc822 format available.

Message #31 received at 11617 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 11617 <at> debbugs.gnu.org
Subject: Re: bug#11617: Don't use 'register'; these days it's not needed.
Date: Mon, 04 Jun 2012 15:30:46 -0400
>> In my world, the keyword "register" is just another kind of whitespace.
> It's a funny kind of whitespace that triggers compiler bugs
> and makes code harder to read....

I wish it were the only kind of whitespace with that property.


        Stefan




bug closed, send any further explanations to 11617 <at> debbugs.gnu.org and Paul Eggert <eggert <at> cs.ucla.edu> Request was from Chong Yidong <cyd <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 22 Sep 2012 11:14:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 20 Oct 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 326 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.