From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Thoughts on getting correct line numbers in the byte compiler's warning messages
Date: Wed, 7 Nov 2018 17:00:36 +0000 [thread overview]
Message-ID: <20181107170036.GA4934@ACM> (raw)
In-Reply-To: <jwvwopq6v8f.fsf-monnier+emacs@gnu.org>
Hello, Stefan.
On Tue, Nov 06, 2018 at 11:29:41 -0500, Stefan Monnier wrote:
> > I timed a bootstrap, unoptimised GCC, with an extra tag check and
> > storage to a global variable inserted into XFIXNUM. (Currently there is
> > no such check there). The slowdown was around 1.3%
> That accumulates for every data type, and it increases code size,
> reduces cache hit rate...
No, it applies mainly to FIXNUM, because XFIXNUM doesn't already check
the Lisp_Type. Other object types already perform this check, so while
it would increase the code size (by how much?) it would have a lesser
run time penalty. There would be a slow down in predicates like
symbolp, when the result is false. This probably wouldn't amount to
much in practice.
Part of that 1.3% (I don't know how big a part) was GCC outputting
warning messages.
Anyhow, do we really need to worry about code size anymore? temacs is
only 7.3 Mb, and the machines people will be running it on will have
several, or more usually many, Gb of RAM. So what if it became 7.5 Mb,
or even 8.0 Mb?
> You may find it acceptable, but I don't, mostly because I know
> fundamentally it's not needed: it's only introduced for short/medium
> term convenience (to avoid having to rewrite a lot of code).
> And I can't see how we'll be able to get rid of it in the long run
> (gradually or not).
> So in the long run it's a bad option.
Yes, it may be a bad option, but possibly less bad than the other bad
options we have.
> > Many of the original forms produced by the reader survive these
> > transformations.
This, as it happens, is not true. Many of the symbols produced by the
reader survive, none of the cons forms do. cconv, we love you. ;-(
> Yeah, that's why I thought of using a hash-table.
> > I've tried 2., and given up on it: everywhere in the compiler where FORM
> > is transformed to NEWFORM, a copy of a hash has to be created for
> > NEWFORM.
I've rediscovered why I gave up on the hash table approach 2. That's
because cconv-convert chews up EVERY list it is presented with and
spits out one which is not EQ to the original, though it is usually
EQUAL. I'm not saying it was written with the object of frustrating
the current exercise (I'm sure it wasn't), but I will say that if that
had been the objective, the end result wouldn't be different from what
we now have.
cconve.el would need to be entirely rewritten if we stick to the hash
table approach. It wouldn't survive anything like unscathed even in an
"extended Lisp Object" solution.
Maybe it would be possible to defer cconv.el processing till after macro
expansion and byte-opt.el stuff. Would this do any good?
The only vague idea I have for saving this, and I don't like it one bit,
is somehow to redefine \` (and possibly \,) in such a way that it would
somehow copy the source position from the original list to the result.
> Same with your new scheme: everywhere where a "big cons-cell" is
> transformed, by a macro you'll get a "small cons-cell".
> That's a constant of all options, AFAICT.
The "extended" symbols would survive. That is a big plus.
> > Also, there's no convenient key for recording the hash of an
> > occurence of a symbol (such as `if').
> Ah, right, I keep forgetting this detail. Yes, that's a major downer.
> > 3. is what I'm proposing, I think.
> Yes [ sorry, you had to guess; I thought it was clear enough].
> > The motivating thing here is that the rest of the system can handle
> > NEW-SPECIAL-OBJECT and get the same result it would have from OBJECT.
> > Hence the use of Lisp_Type 1, or possibly a new pseudovector type.
> How 'bout we don't try to add location to all objects, but only to some
> specific objects? E.g. only cons-cells?
This could work, together with byte-compile-enclosing-form and a subform
number N to get at the non-cons objects (symbols, strings, ..) in a cons
or vector form.
> We could add a new "big cons-cell" type which shares the same tag, and
> just adds additional info after the end of the normal cons-cell
> (cons-cell would either be allocated from small_cons_blocks or
> big_cons_blocks, so you'd have to look at the enclosing cons_block to
> determine which kind of cons-cell you have).
I've been through these sort of thoughts. That idea would be less
effective than the "extended object", since it would only work with
conses, but might be less disruptive. But why should it only work with
conses? Why not with symbols, too?
> So normal code is not slowed down at all (except I guess for the GC
> which will be marginally slower).
Hmmm. Maybe there's something in this idea. :-) Somehow we'd need to
determine the enclosing cons block, given the address of a cons, and
that could be slow.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2018-11-07 17:00 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-01 17:59 Thoughts on getting correct line numbers in the byte compiler's warning messages Alan Mackenzie
2018-11-01 22:45 ` Stefan Monnier
2018-11-05 10:53 ` Alan Mackenzie
2018-11-05 15:57 ` Eli Zaretskii
2018-11-05 16:51 ` Alan Mackenzie
2018-11-06 4:34 ` Herring, Davis
2018-11-06 8:53 ` Alan Mackenzie
2018-11-06 13:56 ` Stefan Monnier
2018-11-06 15:11 ` Alan Mackenzie
2018-11-06 16:29 ` Stefan Monnier
2018-11-06 19:15 ` Alan Mackenzie
2018-11-06 20:04 ` Stefan Monnier
2018-11-07 12:35 ` Alan Mackenzie
2018-11-07 17:11 ` Stefan Monnier
2018-11-07 17:00 ` Alan Mackenzie [this message]
2018-11-07 17:25 ` Stefan Monnier
2018-11-07 18:47 ` Alan Mackenzie
2018-11-07 19:12 ` Stefan Monnier
2018-11-08 14:08 ` Alan Mackenzie
2018-11-08 17:02 ` Stefan Monnier
2018-11-08 22:13 ` Alan Mackenzie
2018-11-11 12:59 ` Alan Mackenzie
2018-11-11 15:53 ` Eli Zaretskii
2018-11-11 20:12 ` Alan Mackenzie
2018-11-11 20:47 ` Stefan Monnier
2018-11-12 3:30 ` Eli Zaretskii
2018-11-12 16:19 ` Eli Zaretskii
2018-11-12 14:16 ` Alan Mackenzie
2018-11-12 15:44 ` Alan Mackenzie
2018-11-12 20:36 ` Stefan Monnier
2018-11-12 21:35 ` Alan Mackenzie
2018-11-14 13:34 ` Stefan Monnier
2018-11-15 16:32 ` Alan Mackenzie
2018-11-15 18:01 ` Stefan Monnier
2018-11-16 14:14 ` Alan Mackenzie
2018-11-08 4:47 ` Michael Heerdegen
2018-11-08 11:07 ` Alan Mackenzie
2018-11-09 2:06 ` Michael Heerdegen
2018-11-10 10:59 ` Alan Mackenzie
2018-11-10 13:20 ` Stefan Monnier
2018-11-11 7:56 ` Michael Heerdegen
2018-11-08 13:45 ` Stefan Monnier
2018-11-09 3:06 ` Michael Heerdegen
2018-11-09 16:15 ` Stefan Monnier
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=20181107170036.GA4934@ACM \
--to=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.