[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: byte-opt.el addition - optimize list of compile-time constants
From: |
Zack Weinberg |
Subject: |
Re: byte-opt.el addition - optimize list of compile-time constants |
Date: |
Wed, 08 Dec 2004 14:47:36 -0800 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>> I seriously wonder how much would break if this optimization were
>> implemented for 'list'. My suspicion is that people don't commonly
>> apply 'eq' to lists in the first place.
>
> Well, try it:
>
> (put 'list 'byte-optimizer 'byte-optimize-pure-func)
> (put 'list* 'byte-optimizer 'byte-optimize-pure-func)
> (put 'cons 'byte-optimizer 'byte-optimize-pure-func)
> (put 'append 'byte-optimizer 'byte-optimize-pure-func)
I checked out CVS Emacs and tried this, and it fails catastrophically
during bootstrap; so I guess my intuition was wrong. Optimizing list
or append with byte-optimize-pure-func causes errors like the following:
In byte-optimize-lapcode:
byte-opt.el:1748:45:Warning: `t' called as a function
byte-opt.el:1970:52:Warning: `nil' called as a function
In end of data: byte-opt.el:2044:1:Warning: the following
functions are not known to be defined: t, nil
and optimizing cons causes
In toplevel form:
../../emacs/lisp/emacs-lisp/byte-opt.el:1508:45:Error: Wrong type
argument: sequencep, 0
-- both of these are from compiling byte-opt.el from 'make bootstrap'.
I'm interested in debugging this, but I don't know how to proceed.
I'll also point out that this does not solve the problem I am
interested in solving; with list optimized via
byte-optimize-pure-func, debug-on-entry byte-optimize-pure-func and
then execute
(disassemble
(lambda nil
`(:a 1 :b 2
:c #'(lambda nil (when (eq (following-char) ?\n) (forward-char 1))))))
and
(disassemble
(lambda nil
`(:a 1 :b 2
:c ,#'(lambda nil (when (eq (following-char) ?\n) (forward-char 1))))))
In the first case, byte-optimize-pure-func is never called and the
inner function is not compiled (I assume this is because ` is being
optimized to ' when there is no , or ,@ anywhere in its form). In the
second place, byte-optimize-pure-func is called, but the optimization
fails because a (function ...) form appears inside the arguments to
list, which does not count as byte-compile-constp. This is the other
problem I mentioned earlier - at the point at which the
'byte-optimizer function for list is called, the inner function has
not yet been compiled, contrary to the general principle that the byte
optimizer operates depth-first.
zw
- byte-opt.el addition - optimize list of compile-time constants, Zack Weinberg, 2004/12/08
- Re: byte-opt.el addition - optimize list of compile-time constants, Stefan Monnier, 2004/12/08
- Re: byte-opt.el addition - optimize list of compile-time constants,
Zack Weinberg <=
- Re: byte-opt.el addition - optimize list of compile-time constants, Stefan Monnier, 2004/12/08
- Re: byte-opt.el addition - optimize list of compile-time constants, Zack Weinberg, 2004/12/08
- Re: byte-opt.el addition - optimize list of compile-time constants, Stefan Monnier, 2004/12/08
- Re: byte-opt.el addition - optimize list of compile-time constants, Zack Weinberg, 2004/12/08
- Re: byte-opt.el addition - optimize list of compile-time constants, Miles Bader, 2004/12/08
- Re: byte-opt.el addition - optimize list of compile-time constants, Zack Weinberg, 2004/12/08
- Re: byte-opt.el addition - optimize list of compile-time constants, Miles Bader, 2004/12/08
- Re: byte-opt.el addition - optimize list of compile-time constants, Zack Weinberg, 2004/12/08
- Re: byte-opt.el addition - optimize list of compile-time constants, Miles Bader, 2004/12/08
- Re: byte-opt.el addition - optimize list of compile-time constants, Zack Weinberg, 2004/12/08