Fix pcase memoizing; change lexbound byte-code marker.
[emacs.git] / lisp / ChangeLog
blob706042381173cd0549fadc8231ebf6962d69620e
1 2011-03-06  Stefan Monnier  <monnier@iro.umontreal.ca>
3         * emacs-lisp/bytecomp.el (byte-compile-arglist-signature):
4         Handle integer arglist descriptor.
5         (byte-compile-make-args-desc): Make integer arglist descriptor.
6         (byte-compile-lambda): Use integer arglist descriptor to mark lexical
7         byte-coded functions instead of an extra slot.
8         * help-fns.el (help-add-fundoc-usage): Don't add a dummy doc.
9         (help-split-fundoc): Return a nil doc if there was no actual doc.
10         (help-function-arglist): Generate an arglist from an integer arg-desc.
11         * emacs-lisp/pcase.el (pcase--memoize): Rename from pcase-memoize;
12         Make only the key weak.
13         (pcase): Change the key used in the memoization table, so it does not
14         always get GC'd away.
15         * emacs-lisp/macroexp.el (macroexpand-all-1): Slight change to the
16         pcase pattern to generate slightly better code.
18 2011-03-01  Stefan Monnier  <monnier@iro.umontreal.ca>
20         * emacs-lisp/cconv.el (cconv-liftwhen): Increase threshold.
21         (cconv-closure-convert-rec): Convert interactive spec in empty lexenv.
22         (cconv-analyse-use): Improve unused vars warnings.
23         (cconv-analyse-form): Analyze interactive spec in empty lexenv.
24         * emacs-lisp/bytecomp.el (byte-compile-lambda): Always byte-compile
25         the interactive spec in lexical-binding mode.
26         (byte-compile-refresh-preloaded): Don't reload byte-compiler files.
27         * custom.el (custom-initialize-default): Use defvar.
28         (custom-declare-variable): Set the special-variable-p flag.
29         * help-fns.el (help-make-usage): Drop leading underscores.
30         * dired.el (dired-revert, dired-make-relative): Mark unused args.
31         (dired-unmark-all-files): Remove unused var `query'.
32         (dired-overwrite-confirmed): Declare.
33         (dired-restore-desktop-buffer): Don't use dynamically scoped arg names.
34         * mpc.el: Mark unused args.
35         (mpc--faster-toggle): Remove unused var `songnb'.
36         * server.el (server-kill-buffer-running): Move before first use.
37         * minibuffer.el: Mark unused args.
39 2011-02-26  Stefan Monnier  <monnier@iro.umontreal.ca>
41         * emacs-lisp/cconv.el (cconv-closure-convert-rec): Fix last change for
42         λ-lift candidates that end up not λ-lifted.
44         * emacs-lisp/cconv.el: Compute freevars in cconv-analyse.
45         (cconv-mutated, cconv-captured): Remove.
46         (cconv-captured+mutated, cconv-lambda-candidates): Don't give them
47         a global value.
48         (cconv-freevars-alist): New var.
49         (cconv-freevars): Remove.
50         (cconv--lookup-let): Remove.
51         (cconv-closure-convert-function): Extract from cconv-closure-convert-rec.
52         (cconv-closure-convert-rec): Adjust to above changes.
53         (fboundp): New function.
54         (cconv-analyse-function, form): Rewrite.
55         * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
56         Handle declare-function here.
57         (byte-compile-obsolete): Remove.
58         (byte-compile-arglist-warn): Check late defsubst here.
59         (byte-compile-file-form): Simplify.
60         (byte-compile-file-form-defsubst): Remove.
61         (byte-compile-macroexpand-declare-function): Rename from
62         byte-compile-declare-function, turn it into a macro-expander.
63         (byte-compile-normal-call): Check obsolescence.
64         (byte-compile-quote-form): Remove.
65         (byte-compile-defmacro): Revert to trunk's definition which seems to
66         work just as well and handles `declare'.
67         * emacs-lisp/byte-run.el (make-obsolete): Don't modify byte-compile.
68         * Makefile.in (BIG_STACK_DEPTH): Increase to 1200.
69         (compile-onefile): Pass $(BIG_STACK_OPTS) before "-l bytecomp".
70         * emacs-lisp/macroexp.el: Use lexbind.
71         (macroexpand-all-1): Check macro obsolescence.
72         * vc/diff-mode.el: Use lexbind.
73         * follow.el (follow-calc-win-end): Simplify.
75 2011-02-25  Stefan Monnier  <monnier@iro.umontreal.ca>
77         * emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
78         `byte-constant'.
79         (byte-compile-close-variables, displaying-byte-compile-warnings):
80         Add edebug spec.
81         (byte-compile-toplevel-file-form): New fun, split out of
82         byte-compile-file-form.
83         (byte-compile-from-buffer): Use it to avoid applying cconv
84         multiple times.
85         (byte-compile): Only strip `function' if it's present.
86         (byte-compile-lambda): Add `reserved-csts' argument.
87         Use new lexenv arg of byte-compile-top-level.
88         (byte-compile-reserved-constants): New var.
89         (byte-compile-constants-vector): Obey it.
90         (byte-compile-constants-vector): Handle new `byte-constant' form.
91         (byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
92         (byte-compile-form): Don't check callargs here.
93         (byte-compile-normal-call): Do it here instead.
94         (byte-compile-push-unknown-constant)
95         (byte-compile-resolve-unknown-constant): Remove, unused.
96         (byte-compile-make-closure): Use `make-byte-code' rather than `curry',
97         putting the environment into the "constant" pool.
98         (byte-compile-get-closed-var): Use special byte-constant.
99         * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
100         intermediate special form `internal-make-vector'.
101         (byte-optimize-lapcode): Handle new form of `byte-constant'.
102         * help-fns.el (describe-function-1): Don't handle funvecs.
103         * emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
104         function if the content is a lambda expression, not if it's a closure.
105         * emacs-lisp/eieio-come.el: Remove.
106         * emacs-lisp/eieio.el: Don't require eieio-comp.
107         (defmethod): Do a bit more work to find the body and wrap it into
108         a function before passing it to eieio-defmethod.
109         (eieio-defmethod): New arg `code' for it.
110         * emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
111         debugger backtrace.
112         * emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
113         more careful when quoting a function value.
114         * emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
115         (cconv-closure-convert-rec): Catch stray `internal-make-closure'.
116         * Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
118 2011-02-21  Stefan Monnier  <monnier@iro.umontreal.ca>
120         * emacs-lisp/cconv.el (cconv-closure-convert-rec): Let the byte
121         compiler choose the representation of closures.
122         (cconv--env-var): Remove.
123         * emacs-lisp/bytecomp.el (byte-compile--env-var): New var.
124         (byte-compile-make-closure, byte-compile-get-closed-var):
125         New functions.
127 2011-02-21  Stefan Monnier  <monnier@iro.umontreal.ca>
129         * subr.el (with-output-to-temp-buffer): New macro.
131         * simple.el (count-words-region): Don't use interactive-p.
133         * minibuffer.el: Use lexical-binding.  Replace all uses of lexical-let.
135         * emacs-lisp/eieio.el (eieio-defgeneric-form-primary-only-one):
136         Call byte-compile rather than byte-compile-lambda.
138         * emacs-lisp/eieio-comp.el (eieio-byte-compile-file-form-defmethod):
139         Rename from byte-compile-file-form-defmethod.
140         Don't byte-compile-lambda.
141         (eieio-byte-compile-defmethod-param-convert): Rename from
142         byte-compile-defmethod-param-convert.
144         * emacs-lisp/cl-extra.el (cl-macroexpand-all): Don't assume that the
145         value of (function (lambda ...)) is self-quoting.
147         * emacs-lisp/cconv.el: Use lexical-binding.
148         (cconv--lookup-let): Rename from cconv-lookup-let.
149         (cconv-closure-convert-rec): Fix handling of captured+mutated
150         arguments in defun/defmacro.
152         * emacs-lisp/bytecomp.el (byte-compile-lapcode):
153         Turn stack-ref-0 into dup.
154         (byte-compile-form): Don't indirect-function since it can signal
155         errors.
156         (byte-compile-stack-ref, byte-compile-stack-set): Adjust to stack-refs
157         being relative to top rather than to bottom in the byte-code.
158         (with-output-to-temp-buffer): Remove.
159         (byte-compile-with-output-to-temp-buffer): Remove.
161         * emacs-lisp/byte-opt.el (byte-compile-side-effect-and-error-free-ops):
162         Remove interactive-p.
163         (byte-optimize-lapcode): Update optimizations now that stack-refs are
164         relative to the top rather than to the bottom.
166 2011-02-19  Stefan Monnier  <monnier@iro.umontreal.ca>
168         * subr.el (save-window-excursion): New macro, moved from C.
169         * emacs-lisp/lisp-mode.el (save-window-excursion): Don't touch.
170         * emacs-lisp/cconv.el (cconv-closure-convert-rec, cconv-analyse-form):
171         Don't handle save-window-excursion any more.
172         * emacs-lisp/bytecomp.el (interactive-p, save-window-excursion):
173         Don't use the byte-code any more.
174         (byte-compile-form): Check macro expansion was done.
175         (byte-compile-save-window-excursion): Remove.
176         * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
177         Ignore save-window-excursion.  Don't macroepand any more.
179 2011-02-18  Stefan Monnier  <monnier@iro.umontreal.ca>
181         * emacs-lisp/pcase.el (pcase--expand, pcase--u, pcase--u1, pcase--q1):
182         Avoid destructuring-bind which results in poorer code.
184 2011-02-17  Stefan Monnier  <monnier@iro.umontreal.ca>
186         * files.el (lexical-binding): Add a safe-local-variable property.
188         * emacs-lisp/cl-macs.el (cl-byte-compile-block): Disable optimization
189         in lexbind, because it needs a different implementation.
191         * emacs-lisp/cconv.el (cconv--set-diff, cconv--set-diff-map)
192         (cconv--map-diff, cconv--map-diff-elem, cconv--map-diff-set): New funs.
193         (cconv--env-var): New constant.
194         (cconv-closure-convert-rec): Use it and use them.  Fix a typo that
195         ended up forgetting to remove entries from lmenvs in `let'.
196         For `lambda' use the outer `fvrs' when building the closure and don't
197         forget to remove `vars' from the `emvrs' and `lmenvs' of the body.
199         * emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
200         Correctly extract arglist from `closure's.
201         (byte-compile-cl-warn): Compiler-macros are run earlier now.
202         (byte-compile-top-level): Bind byte-compile-lexical-environment to nil,
203         except for lambdas.
204         (byte-compile-form): Don't run the compiler-macro expander here.
205         (byte-compile-let): Merge with byte-compile-let*.
206         Don't preserve-body-value if the body's value was discarded.
208         * emacs-lisp/byte-opt.el (byte-inline-lapcode): Check how many elements
209         are added to the stack.
210         (byte-compile-splice-in-already-compiled-code): Don't touch lexical nor
211         byte-compile-depth now that byte-inline-lapcode does it for us.
212         (byte-compile-inline-expand): Don't inline dynbind byte code into
213         lexbind code, since it has to be done differently.
215 2011-02-12  Stefan Monnier  <monnier@iro.umontreal.ca>
217         * emacs-lisp/byte-lexbind.el: Delete.
219         * emacs-lisp/bytecomp.el (byte-compile-current-heap-environment)
220         (byte-compile-current-num-closures): Remove vars.
221         (byte-vec-ref, byte-vec-set): Remove byte codes.
222         (byte-compile-arglist-vars, byte-compile-make-lambda-lexenv): Move from
223         byte-lexbind.el.
224         (byte-compile-lambda): Never build a closure.
225         (byte-compile-closure-code-p, byte-compile-make-closure): Remove.
226         (byte-compile-closure): Simplify.
227         (byte-compile-top-level): Don't mess with heap environments.
228         (byte-compile-dynamic-variable-bind): Always maintain
229         byte-compile-bound-variables.
230         (byte-compile-variable-ref, byte-compile-variable-set): Always just use
231         the stack for lexical vars.
232         (byte-compile-push-binding-init): Simplify.
233         (byte-compile-not-lexical-var-p): New function, moved from cconv.el.
234         (byte-compile-bind, byte-compile-unbind): New functions, moved and
235         simplified from byte-lexbind.el.
236         (byte-compile-let, byte-compile-let*): Simplify.
237         (byte-compile-condition-case): Don't add :fun-body to the bound vars.
238         (byte-compile-defmacro): Simplify.
240         * emacs-lisp/cconv.el (cconv-not-lexical-var-p): Remove.
241         (cconv-freevars, cconv-analyse-function, cconv-analyse-form):
242         Use byte-compile-not-lexical-var-p instead.
244         * help-fns.el (describe-function-1): Fix paren typo.
246         * emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops)
247         (byte-optimize-lapcode): Remove byte-vec-ref and byte-vec-set.
249 2011-02-11  Stefan Monnier  <monnier@iro.umontreal.ca>
251         * emacs-lisp/cconv.el (cconv-closure-convert): Drop `toplevel' arg.
252         (cconv-closure-convert-toplevel): Remove.
253         (cconv-lookup-let): New fun.
254         (cconv-closure-convert-rec): Don't bother with defs-are-legal.
255         Use :fun-body to handle special forms that require closing their forms.
257         * emacs-lisp/bytecomp.el (byte-compile-file-form, byte-compile):
258         Use cconv-closure-convert instead of cconv-closure-convert-toplevel.
259         (byte-compile-lambda, byte-compile-make-closure):
260         * emacs-lisp/byte-lexbind.el (byte-compile-maybe-push-heap-environment):
261         Make sure cconv did its job.
263         * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth
264         before using it.
266         * dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as
267         function argument.
269 2011-02-11  Stefan Monnier  <monnier@iro.umontreal.ca>
271         * emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
272         renamed to `bytecomp-fun'.
274         * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
275         Understand the :fun-body case for catch, save-window-excursion, and
276         condition-case.
277         (byte-compile-maybe-push-heap-environment): No need when nclosures is
278         zero and byte-compile-current-num-closures is -1.
280         * emacs-lisp/cconv.el (cconv-not-lexical-var-p): New function.
281         (cconv-freevars): Use it.
282         (cconv-closure-convert-rec): Avoid `position'.
283         (cconv-analyse-function): New function.
284         (cconv-analyse-form): Use it.  `inclosure' can't be nil any more.
285         Check lexical vars at let-binding time rather than when referenced.
286         For defuns to be in an empty environment and lambdas to take lexical args.
287         Pay attention to the need to build closures in catch, unwind-protect,
288         save-window-excursion, condition-case, and track-mouse.
289         Fix defconst/defvar handling.
291 2011-02-10  Stefan Monnier  <monnier@iro.umontreal.ca>
293         * emacs-lisp/cconv.el (cconv-mutated, cconv-captured)
294         (cconv-captured+mutated, cconv-lambda-candidates): Fix up declaration.
295         (cconv-freevars): Minor cleanup.  Fix handling of the error var in
296         condition-case.
298         * emacs-lisp/bytecomp.el (byte-compile-catch)
299         (byte-compile-unwind-protect, byte-compile-track-mouse)
300         (byte-compile-condition-case, byte-compile-save-window-excursion):
301         Provide a :fun-body alternative, so that info can be propagated from the
302         surrounding context, as is the case for lexical scoping.
304 2011-02-10  Igor Kuzmin  <kuzminig@iro.umontreal.ca>
306         * emacs-lisp/cconv.el: New file.
307         * emacs-lisp/bytecomp.el: Use cconv.
308         (byte-compile-file-form, byte-compile):
309         Call cconv-closure-convert-toplevel when requested.
310         * server.el:
311         * mpc.el:
312         * emacs-lisp/pcase.el:
313         * doc-view.el:
314         * dired.el: Use lexical-binding.
316 2010-12-27  Stefan Monnier  <monnier@iro.umontreal.ca>
318         * emacs-lisp/bytecomp.el (byte-compile-track-mouse): Don't use #'.
320 2010-12-15  Stefan Monnier  <monnier@iro.umontreal.ca>
322         * emacs-lisp/edebug.el (edebug-eval-defun, edebug-eval):
323         * emacs-lisp/lisp-mode.el (eval-last-sexp-1, eval-defun-1):
324         * ielm.el (ielm-eval-input):
325         * simple.el (eval-expression): Use new eval arg to obey lexical-binding.
327 2010-12-14  Stefan Monnier  <monnier@iro.umontreal.ca>
329         * emacs-lisp/bytecomp.el (byte-compile-condition-case): Use push.
331 2010-12-13  Stefan Monnier  <monnier@iro.umontreal.ca>
333         * subr.el (with-lexical-binding): Remove.
335 2010-06-18  Stefan Monnier  <monnier@iro.umontreal.ca>
337         * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
338         specialp -> special-variable-p.
340 2010-06-15  Stefan Monnier  <monnier@iro.umontreal.ca>
342         * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
343         Don't macroexpand before evaluating in eval-and-compile, in case
344         `body's macro expansion uses macros and functions defined in itself.
346 2010-06-14  Stefan Monnier  <monnier@iro.umontreal.ca>
348         * emacs-lisp/bytecomp.el (byte-compile-check-variable):
349         Update byte-compile-not-obsolete-var to byte-compile-not-obsolete-vars.
351         * Makefile.in (.el.elc): Increase max-lisp-eval-depth.
353 2006-12-04  Miles Bader  <miles@gnu.org>
355         * Makefile.in (COMPILE_FIRST_STACK_DEPTH): New variable.
356         (compile, compile-always): Use it.
358 2005-10-24  Miles Bader  <miles@gnu.org>
360         * subr.el (functionp): Re-remove.
362         * emacs-lisp/bytecomp.el (byte-compile-closure): Add optional
363         ADD-LAMBDA argument, which we just pass to `byte-compile-lambda'.
364         (byte-compile-defun): Use ADD-LAMBDA arg to `byte-compile-closure'
365         instead of adding lambda ourselves.
367 2004-08-09  Miles Bader  <miles@gnu.org>
369         Changes from merging the funvec patch:
371         * emacs-lisp/bytecomp.el (byte-compile-make-closure): Use `curry'
372         instead of `vector' to create compiled closures.
374         Merge funvec patch.
376 2004-05-20  Miles Bader  <miles@gnu.org>
378         * subr.el (functionp): Use `funvecp' instead of
379         `byte-compiled-function-p'.
380         * help-fns.el (describe-function-1): Describe curried functions
381         and other funvecs as such.
382         (help-highlight-arguments): Only format things that look like a
383         function.
385 2004-04-29  Miles Bader  <miles@gnu.org>
387         * emacs-lisp/bytecomp.el (byte-compile-top-level): Add new entries
388         to `byte-compile-lexical-environment' at the start, not end.
389         (byte-compile-delay-out): Correctly default STACK-ADJUST to zero.
391         * emacs-lisp/byte-opt.el (byte-opt-update-stack-params):
392         Don't crash on no-op lapcode entries (car is nil).
394         * emacs-lisp/byte-lexbind.el (byte-compile-make-lambda-lexenv):
395         Push a lexvar onto lexenv, not a vinfo!
397 2004-04-11  Miles Bader  <miles@gnu.org>
399         * emacs-lisp/bytecomp.el (byte-compile-top-level):
400         Correctly analyze lexically-bound arguments.
402         * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
403         Use `append' instead of `nconc'.
405         * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo):
406         Don't use backquote to make a mutable data-structure.
407         (byte-compile-lvarinfo-num-refs, byte-compile-lvarinfo-num-sets):
408         Rename to use `num-' instead of `num'.
409         (byte-compile-make-lambda-lexenv): Adjust accordingly.
411 2004-04-10  Miles Bader  <miles@gnu.org>
413         * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
414         Look at variable's global specialp state too.
416 2004-04-09  Miles Bader  <miles@gnu.org>
418         * emacs-lisp/byte-opt.el (byte-optimize-lapcode):
419         Default initial-stack-depth to 0.
420         (byte-optimize-lapcode): Discard the right number of values in
421         the stack-set+discard-->discard optimization.
423 2004-04-02  Miles Bader  <miles@gnu.org>
425         * emacs-lisp/lisp-mode.el (eval-last-sexp-1): Setup the lexical
426         environment if lexical-binding is enabled.
428 2003-10-14  Miles Bader  <miles@gnu.org>
430         * emacs-lisp/macroexp.el (macroexpand-all-1): Special-case
431         `backquote-list*' to avoid stack overflows.
433 2003-04-04  Miles Bader  <miles@gnu.org>
435         * help-fns.el (help-function-arglist): Handle interpreted closures.
437 2002-11-20  Miles Bader  <miles@gnu.org>
439         * emacs-lisp/bytecomp.el (byte-compile-stack-adjustment):
440         Correctly handle discardN* operators.
441         * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Fix stack-depth
442         tracking errors.
444 2002-08-26  Miles Bader  <miles@gnu.org>
446         * international/mule.el (make-char): Macroexpand call to
447         charset-id constructed by `byte-compile' hook.
449         * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defconst value.
451         * emacs-lisp/byte-opt.el (byte-opt-update-stack-params): New macro.
452         (byte-optimize-lapcode): Keep track of stack-depth in final pass too.
453         Add more optimizations for lexical binding.
454         (byte-compile-inline-expand): Macroexpand result of inlining.
456         * emacs-lisp/bytecomp.el (byte-compile-lambda): Update call to
457         byte-compile-closure-initial-lexenv-p.
458         (byte-discardN-preserve-tos): Alias to byte-discardN.
459         (byte-compile-push-binding-init): Don't push unused variables on
460         init-lexenv.
461         (byte-compile-push-binding-init): Don't use LFORMINFO if it's nil.
462         (byte-compile-lambda): Don't look at lexical environment unless
463         we're using lexical binding.
464         (byte-compile-defmacro): Correctly generate macros.
466         * emacs-lisp/byte-lexbind.el (byte-compile-unbind): Optimize the
467         dynamic-bindings-only case.
468         (byte-compile-bind): Don't special-case unused lexical variables.
470         * emacs-lisp/disass.el (disassemble-1): Print arg for discardN ops.
472 2002-08-19  Miles Bader  <miles@gnu.org>
474         * emacs-lisp/byte-opt.el (byte-decompile-bytecode-1):
475         Handle `byte-discardN-preserve-tos' pseudo-op.
476         (byte-compile-side-effect-and-error-free-ops): Add `byte-stack-ref'.
477         (byte-compile-side-effect-free-ops): Add `byte-vec-ref'.
478         (byte-optimize-lapcode): Add some cases for stack-set/ref ops.
479         Add tracking of stack-depth.  Unfinished code to collapse
480         lexical-unbinding sequences.
482         * emacs-lisp/bytecomp.el (byte-compile-lapcode):
483         Handle `byte-discardN-preserve-tos' pseudo-op.
484         (byte-compile-top-level): If there are lexical args, output a TAG
485         op to record the initial stack-depth for the optimizer.
487 2002-08-17  Miles Bader  <miles@gnu.org>
489         * emacs-lisp/bytecomp.el (byte-discardN): Add byte-defop.
490         (byte-compile-lapcode): Include byte-discardN.
491         (byte-compile-lambda): Fixup closure detection.
492         (byte-compile-top-level): Handle arguments for a lexical lambda.
493         (byte-compile-lexical-variable-ref, byte-compile-variable-ref)
494         (byte-compile-variable-set): Use byte-compile-stack-set/ref.
495         (byte-compile-discard): Add new parameters NUM and PRESERVE-TOS.
496         (byte-compile-stack-ref, byte-compile-stack-set): New functions.
497         (byte-compile-push-binding-init): Get the variable list properly
498         from LFORMINFO.
500         * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
501         Ignore setq'd variables we're not interested in.
502         (byte-compile-make-lambda-lexenv): Add assertion that closed-over
503         variables be heap allocated.
504         (byte-compile-closure-initial-lexenv-p): Rename from
505         byte-compile-closure-lexenv-p.
506         (byte-compile-non-stack-bindings-p): Get the variable list
507         properly from LFORMINFO.
508         (byte-compile-maybe-push-heap-environment): Handle the
509         no-closed-over-variables case correctly.
510         (byte-compile-bind): Use byte-compile-stack-set/ref.
511         Don't bother modifying INIT-LEXENV as no one will see the changes.
512         (byte-compile-unbind): Call `byte-compile-discard' to handle
513         unbinding lexical bindings.
515         * emacs-lisp/disass.el (disassemble-internal): Handle closures.
516         (disassemble-1): Handle new bytecodes.
517         * emacs-lisp/byte-opt.el (disassemble-offset): Handle new bytecodes.
519 2002-06-16  Miles Bader  <miles@gnu.org>
521         * emacs-lisp/macroexp.el (macroexp-accumulate): New macro.
522         (macroexpand-all-forms, macroexpand-all-clauses): Use it.
523         * Makefile.in (compile): Undo previous change.
525 2002-06-14  Miles Bader  <miles@gnu.org>
527         * Makefile.in (COMPILE_FIRST): Add `emacs-lisp/macroexp.el'.
528         (compile): Add a special case that compiles `emacs-lisp/macroexp.el'
529         with an increased max-lisp-eval-depth.
531         * emacs-lisp/bytecomp.el: Provide `bytecomp-preload', at the
532         beginning of the file.  Require `byte-lexbind' at compile time.
533         Add a few doc string.
534         (byte-compile-push-bytecodes)
535         (byte-compile-push-bytecode-const2): New macros.
536         (byte-compile-lapcode): Use them.  Do general code cleanup.
537         (byte-compile-initial-macro-environment): Expand macros in
538         byte-compile-eval before passing to byte-compile-top-level.
539         (byte-compile): Use the `byte-compile-initial-macro-environment'.
541         * emacs-lisp/byte-lexbind.el: Require `bytecomp-preload' instead of
542         `bytecomp'.
543         (byte-compile-bind): Use `byte-compile-dynamic-variable-bind' to bind
544         dynamic variables.
545         (byte-compile-maybe-push-heap-environment): Fix function name typo.
547 2002-06-13  Miles Bader  <miles@gnu.org>
549         Byte compiler lexical binding support (not finished yet):
550         * emacs-lisp/bytecomp.el: Require `macroexp'.
551         (byte-compile-lexical-environment)
552         (byte-compile-current-heap-environment)
553         (byte-compile-current-num-closures): New variables.
554         (0, 178, 179, 180, 181): New byte-opcodes.
555         (byte-compile-lapcode): Handle stack-ref/set opcodes.  Signal an
556         error if a delay-output placeholder is not filled in yet.
557         (byte-compile-file-form, byte-compile): Expand all macros with
558         `macroexpand-all'.
559         (byte-compile-file-form-defsubst, byte-compile-form): Don't expand
560         macros here.
561         (byte-compile-make-lambda-lexenv): Autoload.
562         (byte-compile-lambda): Initial code for handling lexically-bound
563         arguments and closures; doesn't work yet.
564         (byte-compile-closure-code-p, byte-compile-make-closure)
565         (byte-compile-closure): New functions.
566         (byte-compile-check-variable, byte-compile-dynamic-variable-op)
567         (byte-compile-dynamic-variable-bind)
568         (byte-compile-lexical-variable-ref, byte-compile-variable-set):
569         New functions.
570         (byte-compile-variable-ref): Remove second argument.  Now only
571         handles real variable references (not setting or binding).
572         (byte-compile-push-unknown-constant)
573         (byte-compile-resolve-unknown-constant): New functions.
574         (byte-compile-funarg, byte-compile-funarg-2): Functions removed.
575         (byte-compile-function-form): Use either `byte-compile-constant'
576         or `byte-compile-closure'.
577         (byte-compile-setq): Use `byte-compile-variable-set' instead of
578         `byte-compile-variable-ref'.
579         (apply, mapcar, mapatoms, mapconcat, mapc, sort):
580         `byte-defop-compiler-1's removed.
581         (byte-compile-while): Make sure lexically-bound variables inside
582         the loop don't get stored in an environment outside the loop.
583         (byte-compile-compute-lforminfo): Autoload.
584         (byte-compile-push-binding-init): New function.
585         (byte-compile-let, byte-compile-let*): Handle lexical binding.
586         (byte-compile-defun): Use `byte-compile-closure' to do the work.
587         (byte-compile-defmacro): Use `byte-compile-make-closure'.
588         (byte-compile-defvar): Expand the generated call to `push' since
589         we're past macroexpansion already.
590         (byte-compile-stack-adjustment): New function.
591         (byte-compile-out): Make second arg optional.  Rewrite for clarity.
592         (byte-compile-delay-out, byte-compile-delayed-out): New functions.
594         * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
595         Don't expand macros here.
597         * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defmacro forms.
599         * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo)
600         (byte-compile-lforminfo-add-var)
601         (byte-compile-lforminfo-note-closure)
602         (byte-compile-compute-lforminfo)
603         (byte-compile-lforminfo-from-lambda)
604         (byte-compile-lforminfo-analyze)
605         (byte-compile-heapenv-add-accessible-env)
606         (byte-compile-heapenv-ensure-access)
607         (byte-compile-rearrange-let-clauses, byte-compile-bind)
608         (byte-compile-unbind): Fix a bunch of typos.
610 2002-06-12  Miles Bader  <miles@gnu.org>
612         * emacs-lisp/byte-lexbind.el, emacs-lisp/macroexp.el: New files.
614         * subr.el (functionp): Function removed (now a subr).
615         * help-fns.el (describe-function-1): Handle interpreted closures.
617 ;; arch-tag: bd1b5b8b-fdb2-425d-9ac2-20689fb0ee70