GNU bug report logs - #72279
[PATCH] Non-local exits from outside the lexical scope are caught by cl-block

Previous Next

Package: emacs;

Reported by: Thuna <thuna.cing <at> gmail.com>

Date: Wed, 24 Jul 2024 17:37:02 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Andrea Corallo <acorallo <at> gnu.org>
To: Thuna <thuna.cing <at> gmail.com>
Cc: 72279 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#72279: [PATCH] Non-local exits from outside the lexical scope are caught by cl-block
Date: Fri, 26 Jul 2024 03:39:46 -0400
Thuna <thuna.cing <at> gmail.com> writes:

>> BTW, for the second patch a simpler solution is to expand
>>
>>     (cl-block A FOO)
>> to
>>     (let ((cl--block--A ',(make-symbol "A")))
>>       (catch cl--block--A FOO))
>>
>> and
>>
>>     (cl-return B FOO)
>> to
>>     (throw cl--block--B FOO)
>>
>> which will signal an "unknown variable cl--block--B" if a `cl-return` is
>> used outside of its block.
>
> Aha, yes, that would indeed be simpler.
>
>> But the optimization of `cl-block` when the tag is not used is
>> important, so I don't think it's a good approach.
>
> I don't have any particular complaints against keeping this
> optimization, but for the record would you be able to expand on what
> exactly the problem is?  It doesn't seem obvious to me that unused
> `catch'es would make such a meaningful difference.

Unused catches are a problem because they bloat bytecode unnecessary,
also they prevent a number of optimizations in the native compiler as
well.  Essentially every time you have a landing pad like a catch you
cannot make assumptions on where you are landing from and what's the
state of your machine.

It's very important we keep on removing unnecessary catches, that's why
I was asking in my previous mail.


  Andrea





This bug report was last modified 162 days ago.

Previous Next


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