GNU bug report logs - #42147
28.0.50; pure vs side-effect-free, missing optimizations?

Previous Next

Package: emacs;

Reported by: Andrea Corallo <andrea_corallo <at> yahoo.it>

Date: Tue, 30 Jun 2020 22:28:02 UTC

Severity: normal

Found in version 28.0.50

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


Message #205 received at 42147-done <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: Mattias Engdegård <mattiase <at> acm.org>
Cc: 42147-done <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>,
 Andrea Corallo <andrea_corallo <at> yahoo.it>
Subject: Re: bug#42147: 28.0.50;
 pure vs side-effect-free, missing optimizations?
Date: Wed, 08 Jul 2020 19:14:43 +0000
Mattias Engdegård <mattiase <at> acm.org> writes:

> +(defun byte-optimize--substitutable-p (expr)
> +  "Whether EXPR is a constant that can be propagated."
> +  ;; Only consider numbers, symbols and strings to be values for substitution
> +  ;; purposes.  Numbers and symbols are immutable, and mutating string
> +  ;; literals (or results from constant-evaluated string-returning functions)
> +  ;; can be considered undefined.
> +  ;; (What about other quoted values, like conses?)
> +  (or (booleanp expr)
> +      (numberp expr)
> +      (stringp expr)
> +      (and (consp expr)
> +           (eq (car expr) 'quote)
> +           (symbolp (cadr expr)))
> +      (keywordp expr)))

Hi Mattias,

in the branch I'm working I've a function similar in scope to this so
reading your patch this got my attention.

In my version I assumed (after a look to the manual) to have strings to
be immutable only at speed 3.  Is it safe to assume this always instead?

Also I wanted ask why symbols are not included but only keywords, is
this to respect the side effect of interning them or something else?

Thanks!

  Andrea

-- 
akrl <at> sdf.org




This bug report was last modified 4 years and 282 days ago.

Previous Next


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