unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] feature/byte-switch 44c95c5: bytecomp.el: Don't store non-keyword symbols in jump-tables.
       [not found] ` <20170205102302.97A0822014A@vcs.savannah.gnu.org>
@ 2017-02-05 15:14   ` Stefan Monnier
  2017-02-05 17:24     ` Vibhav Pant
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2017-02-05 15:14 UTC (permalink / raw)
  To: emacs-devel; +Cc: Vibhav Pant

>  (defun byte-compile-cond-valid-obj2-p (obj)
> -  (if (consp obj)
> -      (and (eq (car obj) 'quote)
> -           (= (length obj) 2)
> -           (symbolp (cadr obj)))
> -    t))
> +  (cond
> +   ((consp obj)
> +    (and (eq (car obj) 'quote)
> +         (= (length obj) 2)
> +         (symbolp (cadr obj))))
> +   ((symbolp obj) (keywordp obj))
> +   (t t)))

I suggest you document the property that you need this to satisfy.
E.g. something like "OBJ is a constant expression whose value can be
compared with `eq`" or something like that.  And you might like to see if
maybe you can use macroexp-const-p in here (there are many different
definitions of "constant", tho).


        Stefan



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Emacs-diffs] feature/byte-switch 44c95c5: bytecomp.el: Don't store non-keyword symbols in jump-tables.
  2017-02-05 15:14   ` [Emacs-diffs] feature/byte-switch 44c95c5: bytecomp.el: Don't store non-keyword symbols in jump-tables Stefan Monnier
@ 2017-02-05 17:24     ` Vibhav Pant
  2017-02-05 17:50       ` Clément Pit-Claudel
  0 siblings, 1 reply; 3+ messages in thread
From: Vibhav Pant @ 2017-02-05 17:24 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel@gnu.org

On Sun, Feb 5, 2017 at 8:44 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> I suggest you document the property that you need this to satisfy.
> E.g. something like "OBJ is a constant expression whose value can be
> compared with `eq`" or something like that.  And you might like to see if
> maybe you can use macroexp-const-p in here (there are many different
> definitions of "constant", tho).

macroexp-const-p seems to be a much better alternative to this. I've replaced
byte-compile-cond-valid-obj2-p altogether with this. It seems to return non-nil
for constant expressions that would work in a jump table implementation.

At some point, I would like to extend this to forms that call functions, but
that would need additional code to make sure that the callee function doesn't
modify the value of the variable we're comparing against (is there some way
to do that already?).

Thanks,
Vibhav

-- 
Vibhav Pant
vibhavp@gmail.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Emacs-diffs] feature/byte-switch 44c95c5: bytecomp.el: Don't store non-keyword symbols in jump-tables.
  2017-02-05 17:24     ` Vibhav Pant
@ 2017-02-05 17:50       ` Clément Pit-Claudel
  0 siblings, 0 replies; 3+ messages in thread
From: Clément Pit-Claudel @ 2017-02-05 17:50 UTC (permalink / raw)
  To: Vibhav Pant, Stefan Monnier; +Cc: emacs-devel@gnu.org

On 2017-02-05 12:24, Vibhav Pant wrote:
> that would need additional code to make sure that the callee function doesn't
> modify the value of the variable we're comparing against (is there some way
> to do that already?).

I've seen (declare (side-effect-free t)) and (declare (pure t)) in the sources, and there's a file called unsafep.el; maybe one of these is a good starting point?
(This branch is pretty exciting, keep up the good work!)

Cheers,
Clément.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-05 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170205102302.10649.95044@vcs.savannah.gnu.org>
     [not found] ` <20170205102302.97A0822014A@vcs.savannah.gnu.org>
2017-02-05 15:14   ` [Emacs-diffs] feature/byte-switch 44c95c5: bytecomp.el: Don't store non-keyword symbols in jump-tables Stefan Monnier
2017-02-05 17:24     ` Vibhav Pant
2017-02-05 17:50       ` Clément Pit-Claudel

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).