From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: scratch/accurate-warning-pos: next steps.
Date: Mon, 10 Dec 2018 21:03:10 +0000 [thread overview]
Message-ID: <20181210210310.GF4188@ACM> (raw)
In-Reply-To: <83y38x1706.fsf@gnu.org>
Hello, Eli.
On Mon, Dec 10, 2018 at 22:06:33 +0200, Eli Zaretskii wrote:
> > Date: Mon, 10 Dec 2018 19:35:57 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>
> > > Then how about invoking this alternative interpreter only if the prime
> > > interpreter detected a warning or error while byte-compiling? You
> > > could invoke the alternative interpreter only on the form where the
> > > problem was detected, with the goal of "drilling down" to find the
> > > exact position of the problematic symbol(s).
> > That would mean starting the byte compilation with no position
> > information being gathered, and then when an warning occurs, aborting
> > the compilation and starting again from scratch with the position
> > information being gather and alternative interpreter being used.
> Not necessarily. It could mean invocation of a special code whose
> goal is to find the position of an error in a given form. The
> position of the beginning of this form will have been known, as AFAIU
> the existing byte compiler does collect that, or has means to
> determine that.
We know the position of the beginning of the form, yes. We need some way
of determining the source position of a symbol, cons, or vector on the
inside of this form.
The traditional alist of symbols and positions is one way, and it no
longer works well (if it ever did). Symbols with position is another
way, which appears to work well, in spite of the complexity.
You seem to be proposing a third way, but without giving away any
details.
> > The problem is, that we cannot use #<symbol nil at 666> in the normal
> > interpreter, since it is not EQ nil there.
> I'm not sure you must use symbols with positions in the above
> arrangement, you could simply invoke special-purpose code that
> analyzed the problematic form. But if you do need to use symbols with
> positions, you could do this only when looking for error position, so
> other symbol comparisons will not be affected.
I'm not sure how this special-purpose code would work. Say we find an
error or warning involving symbol foo as the car of some form, I can't
see any way of determining its source position that doesn't involve going
back to the position of the beginning of the form, and slogging through
the form, somehow.
Maybe, rather than reading the form, we could scan it a token at a time,
storing it in, say vectors, rather like a traditional non-lisp compiler
does. But this is hardly attractive, and would be a LOT of work.
> > I understand the idea, yes. But given the timings I measured in the
> > existing scratch/accurate-warning-pos (IIRC, around 11% - 12% for an
> > actual compilation) and the fact that in the alternative interpreter,
> > the slowdown will be somewhat less (one fewer flag comparison per EQ,
> > NILP, ...., and we can drop the traditional alist of symbols and
> > positions which is running alongside the new symbols with position) it
> > may not be worth the extra complexity.
> Yes, but what you suggested as the implementation of the alternative
> interpreter includes a heck of complexity of its own, IMO.
It does, yes. Partly imposed by external circumstances. ;-)
> The idea I proposed doesn't even require changes in basic types, it
> could hopefully be implemented with "normal" Lisp.
The symbols with positions idea doesn't conceptually change basic types
either - it just adds annotations to an existing type. Anything you
could do with symbols before, you can still do with
symbols-with-positions and get the same answers now.
If you have come up with a new way of getting a source position for a
symbol or a cons, please detail it here. I recognise the complexity in
what I'm proposing and what I've already implemented, and I don't think
it's good; it's just less bad than anything else that's come up, so far.
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2018-12-10 21:03 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-10 18:00 scratch/accurate-warning-pos: next steps Alan Mackenzie
2018-12-10 18:15 ` Eli Zaretskii
2018-12-10 18:28 ` Alan Mackenzie
2018-12-10 18:39 ` Eli Zaretskii
2018-12-10 19:35 ` Alan Mackenzie
2018-12-10 20:06 ` Eli Zaretskii
2018-12-10 21:03 ` Alan Mackenzie [this message]
2018-12-11 6:41 ` Eli Zaretskii
2018-12-11 19:21 ` Stefan Monnier
2018-12-11 19:07 ` Stefan Monnier
2018-12-10 23:54 ` Paul Eggert
2018-12-11 11:34 ` Alan Mackenzie
2018-12-11 18:05 ` Paul Eggert
2018-12-11 19:20 ` Alan Mackenzie
2018-12-11 19:59 ` Paul Eggert
2018-12-11 20:51 ` Alan Mackenzie
2018-12-11 21:11 ` Stefan Monnier
2018-12-11 21:35 ` Alan Mackenzie
2018-12-11 22:58 ` Stefan Monnier
2018-12-11 21:43 ` Paul Eggert
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=20181210210310.GF4188@ACM \
--to=acm@muc.de \
--cc=eliz@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.