From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: emacs-devel@gnu.org
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: [Emacs-diffs] feature/byte-unwind-protect 916094a 2/2: Add new bytecodes for unwind-protect
Date: Tue, 23 Jan 2018 10:35:31 -0500 [thread overview]
Message-ID: <jwvr2qg7h5h.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <20180123051232.EBBB6207FC@vcs0.savannah.gnu.org> (Tom Tromey's message of "Tue, 23 Jan 2018 00:12:32 -0500 (EST)")
> + (if (not byte-compile--use-old-handlers)
> + (let ((except-tag (byte-compile-make-tag)))
[...]
> + (pcase (cddr form)
> + (`(:fun-body ,f)
> + (byte-compile-form
> + (if byte-compile--use-old-handlers `(list (list 'funcall ,f)) f)))
> + (handlers
> + (if byte-compile--use-old-handlers
Clearly the last two tests of byte-compile--use-old-handlers can be
dropped since they're inside a branch where we know
byte-compile--use-old-handlers is t.
BTW, when introducing byte-codes we've "traditionally" done it in two steps:
- in release N we add the code which handles the new byte-codes,
and we add support for the new byte-code in the byte-compiler, but
disabled by default.
- in release N+1 we enable the use of the new byte-codes in the
byte-compiler by default.
This is done so as to reduce the pain when running a file compiled with
another Emacs version.
But we don't want to set byte-compile--use-old-handlers back to nil for
your new bytecodes, so better use another variable.
Also byte-compile--use-old-handlers can be retired, I think, because it
has played its role.
> + CASE (Bpushunwindprotect): /* New in 27.1. */
> + {
> + struct handler *c = push_handler (Qt, CATCHER_ALL);
Hmm... using this "catch+rethrow" method interferes with the
debug-on-error stacktrace:
(defun sm-test-1 () (unwind-protect (sm-test-2) (message "hello")))
(defun sm-test-2 () (message "test-1-in") (car 4))
(setq debug-on-error t)
then call `sm-test-1` and you'll see that Emacs gives you a backtrace
that gives the impression the error was signaled in `sm-test-1`!
I also wonder if there can be places where we call something like
`unbind_to` which should run those new unwind-forms but won't find it
because it won't look at the handlers [ offhand, I can't think of any
place where that would happen, and I think it's probably OK, but
I can't quite convince myself that it definitely is. ]
All in all, I'd really prefer if we kept the unwind forms in
the specpdl. Was there a particular reason why you used the
handlers instead?
Stefan
next parent reply other threads:[~2018-01-23 15:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180123051231.6240.43062@vcs0.savannah.gnu.org>
[not found] ` <20180123051232.EBBB6207FC@vcs0.savannah.gnu.org>
2018-01-23 15:35 ` Stefan Monnier [this message]
2018-01-23 15:44 ` [Emacs-diffs] feature/byte-unwind-protect 916094a 2/2: Add new bytecodes for unwind-protect Tom Tromey
2018-01-23 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=jwvr2qg7h5h.fsf-monnier+emacsdiffs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=tom@tromey.com \
/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.