1 2011-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
3 * emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
4 Add byte-code-function-p.
5 (pcase--u1): Remove left-over code from early development.
6 Fix case of variable shadowing in guards and predicates.
7 (pcase--u1): Add a new `let' pattern.
9 * emacs-lisp/bytecomp.el: Remove the bytecomp- prefix now that we use
11 (byte-compile-outbuffer): Rename from bytecomp-outbuffer.
12 * emacs-lisp/cl-macs.el (load-time-value):
13 * emacs-lisp/cl.el (cl-compiling-file): Adjust to new name.
15 * emacs-lisp/byte-opt.el (byte-compile-inline-expand): Make it work to
16 inline lexbind interpreted functions into lexbind code.
17 (bytedecomp-bytes): Not a dynamic var any more.
18 (disassemble-offset): Get the bytes via an argument instead.
19 (byte-decompile-bytecode-1): Use push.
21 2011-03-15 Stefan Monnier <monnier@iro.umontreal.ca>
23 * makefile.w32-in (COMPILE_FIRST): Fix up last change.
24 * ldefs-boot.el: Revert to upstream's version.
26 2011-03-13 Stefan Monnier <monnier@iro.umontreal.ca>
28 * help-fns.el (help-function-arglist):
29 * emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
30 * subr.el (apply-partially): Adjust to new format.
31 * emacs-lisp/disass.el (disassemble-internal): Catch closures.
33 2011-03-12 Stefan Monnier <monnier@iro.umontreal.ca>
35 * subr.el (apply-partially): Move from subr.el; don't use lexical-let.
36 (eval-after-load): Obey lexical-binding.
37 * simple.el (apply-partially): Move to subr.el.
38 * makefile.w32-in: Match changes in Makefile.in.
39 (BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
40 (.el.elc, compile-CMD, compile-SH, compile-always-CMD)
41 (compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
42 (COMPILE_FIRST): Add pcase, macroexp, and cconv.
43 * emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
44 calling CL's `compiler-macroexpand'.
45 * emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
46 (byte-compile-initial-macro-environment)
47 (byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp):
49 (byte-compile-eval, byte-compile-eval-before-compile):
51 (byte-compile--for-effect): Rename from `for-effect'.
52 (display-call-tree): Use case.
53 * emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
54 (byte-optimize-form-code-walker, byte-optimize-form):
55 Revert to old arg name.
56 * Makefile.in (BYTE_COMPILE_FLAGS): New var.
57 (compile-onefile, .el.elc, compile-calc, recompile): Use it.
59 2011-03-11 Stefan Monnier <monnier@iro.umontreal.ca>
61 * subr.el (letrec): New macro.
62 (with-wrapper-hook): Move from simple.el and don't use CL.
63 * simple.el (with-wrapper-hook): Move with-wrapper-hook to subr.el.
64 * help-fns.el (help-function-arglist): Handle subroutines as well.
65 (describe-variable): Use special-variable-p to filter completions.
66 * emacs-lisp/macroexp.el (macroexpand-all-1): Don't expand `declare'
68 * emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form):
70 * emacs-lisp/cl.el (pushnew): Silence unfixable warning.
71 * emacs-lisp/cl-macs.el (defstruct, define-compiler-macro):
72 Mark unused arg as unused.
73 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Use memq.
74 * emacs-lisp/autoload.el (make-autoload): Don't assume the macro's
76 (autoload-generate-file-autoloads): Improve error message.
77 * emacs-lisp/advice.el (ad-arglist): Use help-function-arglist
78 to understand the new byte-code arg format.
84 * textmodes/css-mode.el:
85 * textmodes/bibtex-style.el:
89 * abbrev.el: Use lexical-binding.
91 2011-03-10 Stefan Monnier <monnier@iro.umontreal.ca>
93 * emacs-lisp/bytecomp.el: Use lexical-binding.
94 (byte-recompile-directory): Remove unused var `bytecomp-dest'.
95 (byte-recompile-file): Use derived-mode-p.
96 (byte-compile-from-buffer): Remove arg `bytecomp-filename'.
97 Use byte-compile-current-file instead.
98 (byte-compile-file): Adjust call accordingly.
99 (bytecomp-outbuffer): Move declaration before first use.
100 (for-effect): Declare dynamic.
101 (byte-compile-file-form-defmumble): Use byte-compile-current-file.
102 (byte-compile-top-level, byte-compile-out-toplevel, byte-compile-form):
103 Move dyn-binding of for-effect from function argument to let binding.
104 (byte-compile-out-toplevel): Don't both passing for-effect to
105 byte-optimize-lapcode.
106 (byte-compile-top-level-body, byte-compile-body):
107 Rename for-effect -> for-effect-arg so it's lexical.
109 * subr.el (functionp): Remove, now that it's in src/eval.c.
111 * emacs-lisp/byte-opt.el: Use lexical-binding.
112 (for-effectm byte-compile-tag-number): Declare dynamic.
113 (byte-optimize-form-code-walker, byte-optimize-form): Move dynamic
114 binding of for-effect from function argument to let binding.
115 (byte-decompile-bytecode-1): Move dynamic binding of bytedecomp-bytes
116 from function argument to let binding.
118 * emacs-lisp/cconv.el (cconv--convert-function): Rename from
119 cconv-closure-convert-function.
120 (cconv-convert): Rename from cconv-closure-convert-rec.
121 (cconv--analyse-use): Rename from cconv-analyse-use.
122 (cconv--analyse-function): Rename from cconv-analyse-function.
123 (cconv--analyse-use): Change some patterns to silence compiler.
124 (cconv-convert, cconv--convert-function): Rewrite.
125 * emacs-lisp/byte-opt.el (byte-compile-inline-expand): Adjust check for
126 new byte-code representation.
128 2011-03-06 Stefan Monnier <monnier@iro.umontreal.ca>
130 * emacs-lisp/bytecomp.el (byte-compile-arglist-signature):
131 Handle integer arglist descriptor.
132 (byte-compile-make-args-desc): Make integer arglist descriptor.
133 (byte-compile-lambda): Use integer arglist descriptor to mark lexical
134 byte-coded functions instead of an extra slot.
135 * help-fns.el (help-add-fundoc-usage): Don't add a dummy doc.
136 (help-split-fundoc): Return a nil doc if there was no actual doc.
137 (help-function-arglist): Generate an arglist from an integer arg-desc.
138 * emacs-lisp/pcase.el (pcase--memoize): Rename from pcase-memoize;
139 Make only the key weak.
140 (pcase): Change the key used in the memoization table, so it does not
141 always get GC'd away.
142 * emacs-lisp/macroexp.el (macroexpand-all-1): Slight change to the
143 pcase pattern to generate slightly better code.
145 2011-03-01 Stefan Monnier <monnier@iro.umontreal.ca>
147 * emacs-lisp/cconv.el (cconv-liftwhen): Increase threshold.
148 (cconv-closure-convert-rec): Convert interactive spec in empty lexenv.
149 (cconv-analyse-use): Improve unused vars warnings.
150 (cconv-analyse-form): Analyze interactive spec in empty lexenv.
151 * emacs-lisp/bytecomp.el (byte-compile-lambda): Always byte-compile
152 the interactive spec in lexical-binding mode.
153 (byte-compile-refresh-preloaded): Don't reload byte-compiler files.
154 * custom.el (custom-initialize-default): Use defvar.
155 (custom-declare-variable): Set the special-variable-p flag.
156 * help-fns.el (help-make-usage): Drop leading underscores.
157 * dired.el (dired-revert, dired-make-relative): Mark unused args.
158 (dired-unmark-all-files): Remove unused var `query'.
159 (dired-overwrite-confirmed): Declare.
160 (dired-restore-desktop-buffer): Don't use dynamically scoped arg names.
161 * mpc.el: Mark unused args.
162 (mpc--faster-toggle): Remove unused var `songnb'.
163 * server.el (server-kill-buffer-running): Move before first use.
164 * minibuffer.el: Mark unused args.
166 2011-02-26 Stefan Monnier <monnier@iro.umontreal.ca>
168 * emacs-lisp/cconv.el (cconv-closure-convert-rec): Fix last change for
169 λ-lift candidates that end up not λ-lifted.
171 * emacs-lisp/cconv.el: Compute freevars in cconv-analyse.
172 (cconv-mutated, cconv-captured): Remove.
173 (cconv-captured+mutated, cconv-lambda-candidates): Don't give them
175 (cconv-freevars-alist): New var.
176 (cconv-freevars): Remove.
177 (cconv--lookup-let): Remove.
178 (cconv-closure-convert-function): Extract from cconv-closure-convert-rec.
179 (cconv-closure-convert-rec): Adjust to above changes.
180 (fboundp): New function.
181 (cconv-analyse-function, form): Rewrite.
182 * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
183 Handle declare-function here.
184 (byte-compile-obsolete): Remove.
185 (byte-compile-arglist-warn): Check late defsubst here.
186 (byte-compile-file-form): Simplify.
187 (byte-compile-file-form-defsubst): Remove.
188 (byte-compile-macroexpand-declare-function): Rename from
189 byte-compile-declare-function, turn it into a macro-expander.
190 (byte-compile-normal-call): Check obsolescence.
191 (byte-compile-quote-form): Remove.
192 (byte-compile-defmacro): Revert to trunk's definition which seems to
193 work just as well and handles `declare'.
194 * emacs-lisp/byte-run.el (make-obsolete): Don't modify byte-compile.
195 * Makefile.in (BIG_STACK_DEPTH): Increase to 1200.
196 (compile-onefile): Pass $(BIG_STACK_OPTS) before "-l bytecomp".
197 * emacs-lisp/macroexp.el: Use lexbind.
198 (macroexpand-all-1): Check macro obsolescence.
199 * vc/diff-mode.el: Use lexbind.
200 * follow.el (follow-calc-win-end): Simplify.
202 2011-02-25 Stefan Monnier <monnier@iro.umontreal.ca>
204 * emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
206 (byte-compile-close-variables, displaying-byte-compile-warnings):
208 (byte-compile-toplevel-file-form): New fun, split out of
209 byte-compile-file-form.
210 (byte-compile-from-buffer): Use it to avoid applying cconv
212 (byte-compile): Only strip `function' if it's present.
213 (byte-compile-lambda): Add `reserved-csts' argument.
214 Use new lexenv arg of byte-compile-top-level.
215 (byte-compile-reserved-constants): New var.
216 (byte-compile-constants-vector): Obey it.
217 (byte-compile-constants-vector): Handle new `byte-constant' form.
218 (byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
219 (byte-compile-form): Don't check callargs here.
220 (byte-compile-normal-call): Do it here instead.
221 (byte-compile-push-unknown-constant)
222 (byte-compile-resolve-unknown-constant): Remove, unused.
223 (byte-compile-make-closure): Use `make-byte-code' rather than `curry',
224 putting the environment into the "constant" pool.
225 (byte-compile-get-closed-var): Use special byte-constant.
226 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
227 intermediate special form `internal-make-vector'.
228 (byte-optimize-lapcode): Handle new form of `byte-constant'.
229 * help-fns.el (describe-function-1): Don't handle funvecs.
230 * emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
231 function if the content is a lambda expression, not if it's a closure.
232 * emacs-lisp/eieio-come.el: Remove.
233 * emacs-lisp/eieio.el: Don't require eieio-comp.
234 (defmethod): Do a bit more work to find the body and wrap it into
235 a function before passing it to eieio-defmethod.
236 (eieio-defmethod): New arg `code' for it.
237 * emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
239 * emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
240 more careful when quoting a function value.
241 * emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
242 (cconv-closure-convert-rec): Catch stray `internal-make-closure'.
243 * Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.
245 2011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
247 * emacs-lisp/cconv.el (cconv-closure-convert-rec): Let the byte
248 compiler choose the representation of closures.
249 (cconv--env-var): Remove.
250 * emacs-lisp/bytecomp.el (byte-compile--env-var): New var.
251 (byte-compile-make-closure, byte-compile-get-closed-var):
254 2011-02-21 Stefan Monnier <monnier@iro.umontreal.ca>
256 * subr.el (with-output-to-temp-buffer): New macro.
258 * simple.el (count-words-region): Don't use interactive-p.
260 * minibuffer.el: Use lexical-binding. Replace all uses of lexical-let.
262 * emacs-lisp/eieio.el (eieio-defgeneric-form-primary-only-one):
263 Call byte-compile rather than byte-compile-lambda.
265 * emacs-lisp/eieio-comp.el (eieio-byte-compile-file-form-defmethod):
266 Rename from byte-compile-file-form-defmethod.
267 Don't byte-compile-lambda.
268 (eieio-byte-compile-defmethod-param-convert): Rename from
269 byte-compile-defmethod-param-convert.
271 * emacs-lisp/cl-extra.el (cl-macroexpand-all): Don't assume that the
272 value of (function (lambda ...)) is self-quoting.
274 * emacs-lisp/cconv.el: Use lexical-binding.
275 (cconv--lookup-let): Rename from cconv-lookup-let.
276 (cconv-closure-convert-rec): Fix handling of captured+mutated
277 arguments in defun/defmacro.
279 * emacs-lisp/bytecomp.el (byte-compile-lapcode):
280 Turn stack-ref-0 into dup.
281 (byte-compile-form): Don't indirect-function since it can signal
283 (byte-compile-stack-ref, byte-compile-stack-set): Adjust to stack-refs
284 being relative to top rather than to bottom in the byte-code.
285 (with-output-to-temp-buffer): Remove.
286 (byte-compile-with-output-to-temp-buffer): Remove.
288 * emacs-lisp/byte-opt.el (byte-compile-side-effect-and-error-free-ops):
289 Remove interactive-p.
290 (byte-optimize-lapcode): Update optimizations now that stack-refs are
291 relative to the top rather than to the bottom.
293 2011-02-19 Stefan Monnier <monnier@iro.umontreal.ca>
295 * subr.el (save-window-excursion): New macro, moved from C.
296 * emacs-lisp/lisp-mode.el (save-window-excursion): Don't touch.
297 * emacs-lisp/cconv.el (cconv-closure-convert-rec, cconv-analyse-form):
298 Don't handle save-window-excursion any more.
299 * emacs-lisp/bytecomp.el (interactive-p, save-window-excursion):
300 Don't use the byte-code any more.
301 (byte-compile-form): Check macro expansion was done.
302 (byte-compile-save-window-excursion): Remove.
303 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
304 Ignore save-window-excursion. Don't macroepand any more.
306 2011-02-18 Stefan Monnier <monnier@iro.umontreal.ca>
308 * emacs-lisp/pcase.el (pcase--expand, pcase--u, pcase--u1, pcase--q1):
309 Avoid destructuring-bind which results in poorer code.
311 2011-02-17 Stefan Monnier <monnier@iro.umontreal.ca>
313 * files.el (lexical-binding): Add a safe-local-variable property.
315 * emacs-lisp/cl-macs.el (cl-byte-compile-block): Disable optimization
316 in lexbind, because it needs a different implementation.
318 * emacs-lisp/cconv.el (cconv--set-diff, cconv--set-diff-map)
319 (cconv--map-diff, cconv--map-diff-elem, cconv--map-diff-set): New funs.
320 (cconv--env-var): New constant.
321 (cconv-closure-convert-rec): Use it and use them. Fix a typo that
322 ended up forgetting to remove entries from lmenvs in `let'.
323 For `lambda' use the outer `fvrs' when building the closure and don't
324 forget to remove `vars' from the `emvrs' and `lmenvs' of the body.
326 * emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
327 Correctly extract arglist from `closure's.
328 (byte-compile-cl-warn): Compiler-macros are run earlier now.
329 (byte-compile-top-level): Bind byte-compile-lexical-environment to nil,
331 (byte-compile-form): Don't run the compiler-macro expander here.
332 (byte-compile-let): Merge with byte-compile-let*.
333 Don't preserve-body-value if the body's value was discarded.
335 * emacs-lisp/byte-opt.el (byte-inline-lapcode): Check how many elements
336 are added to the stack.
337 (byte-compile-splice-in-already-compiled-code): Don't touch lexical nor
338 byte-compile-depth now that byte-inline-lapcode does it for us.
339 (byte-compile-inline-expand): Don't inline dynbind byte code into
340 lexbind code, since it has to be done differently.
342 2011-02-12 Stefan Monnier <monnier@iro.umontreal.ca>
344 * emacs-lisp/byte-lexbind.el: Delete.
346 * emacs-lisp/bytecomp.el (byte-compile-current-heap-environment)
347 (byte-compile-current-num-closures): Remove vars.
348 (byte-vec-ref, byte-vec-set): Remove byte codes.
349 (byte-compile-arglist-vars, byte-compile-make-lambda-lexenv): Move from
351 (byte-compile-lambda): Never build a closure.
352 (byte-compile-closure-code-p, byte-compile-make-closure): Remove.
353 (byte-compile-closure): Simplify.
354 (byte-compile-top-level): Don't mess with heap environments.
355 (byte-compile-dynamic-variable-bind): Always maintain
356 byte-compile-bound-variables.
357 (byte-compile-variable-ref, byte-compile-variable-set): Always just use
358 the stack for lexical vars.
359 (byte-compile-push-binding-init): Simplify.
360 (byte-compile-not-lexical-var-p): New function, moved from cconv.el.
361 (byte-compile-bind, byte-compile-unbind): New functions, moved and
362 simplified from byte-lexbind.el.
363 (byte-compile-let, byte-compile-let*): Simplify.
364 (byte-compile-condition-case): Don't add :fun-body to the bound vars.
365 (byte-compile-defmacro): Simplify.
367 * emacs-lisp/cconv.el (cconv-not-lexical-var-p): Remove.
368 (cconv-freevars, cconv-analyse-function, cconv-analyse-form):
369 Use byte-compile-not-lexical-var-p instead.
371 * help-fns.el (describe-function-1): Fix paren typo.
373 * emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops)
374 (byte-optimize-lapcode): Remove byte-vec-ref and byte-vec-set.
376 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
378 * emacs-lisp/cconv.el (cconv-closure-convert): Drop `toplevel' arg.
379 (cconv-closure-convert-toplevel): Remove.
380 (cconv-lookup-let): New fun.
381 (cconv-closure-convert-rec): Don't bother with defs-are-legal.
382 Use :fun-body to handle special forms that require closing their forms.
384 * emacs-lisp/bytecomp.el (byte-compile-file-form, byte-compile):
385 Use cconv-closure-convert instead of cconv-closure-convert-toplevel.
386 (byte-compile-lambda, byte-compile-make-closure):
387 * emacs-lisp/byte-lexbind.el (byte-compile-maybe-push-heap-environment):
388 Make sure cconv did its job.
390 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth
393 * dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as
396 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
398 * emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
399 renamed to `bytecomp-fun'.
401 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
402 Understand the :fun-body case for catch, save-window-excursion, and
404 (byte-compile-maybe-push-heap-environment): No need when nclosures is
405 zero and byte-compile-current-num-closures is -1.
407 * emacs-lisp/cconv.el (cconv-not-lexical-var-p): New function.
408 (cconv-freevars): Use it.
409 (cconv-closure-convert-rec): Avoid `position'.
410 (cconv-analyse-function): New function.
411 (cconv-analyse-form): Use it. `inclosure' can't be nil any more.
412 Check lexical vars at let-binding time rather than when referenced.
413 For defuns to be in an empty environment and lambdas to take lexical args.
414 Pay attention to the need to build closures in catch, unwind-protect,
415 save-window-excursion, condition-case, and track-mouse.
416 Fix defconst/defvar handling.
418 2011-02-10 Stefan Monnier <monnier@iro.umontreal.ca>
420 * emacs-lisp/cconv.el (cconv-mutated, cconv-captured)
421 (cconv-captured+mutated, cconv-lambda-candidates): Fix up declaration.
422 (cconv-freevars): Minor cleanup. Fix handling of the error var in
425 * emacs-lisp/bytecomp.el (byte-compile-catch)
426 (byte-compile-unwind-protect, byte-compile-track-mouse)
427 (byte-compile-condition-case, byte-compile-save-window-excursion):
428 Provide a :fun-body alternative, so that info can be propagated from the
429 surrounding context, as is the case for lexical scoping.
431 2011-02-10 Igor Kuzmin <kuzminig@iro.umontreal.ca>
433 * emacs-lisp/cconv.el: New file.
434 * emacs-lisp/bytecomp.el: Use cconv.
435 (byte-compile-file-form, byte-compile):
436 Call cconv-closure-convert-toplevel when requested.
439 * emacs-lisp/pcase.el:
441 * dired.el: Use lexical-binding.
443 2010-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
445 * emacs-lisp/bytecomp.el (byte-compile-track-mouse): Don't use #'.
447 2010-12-15 Stefan Monnier <monnier@iro.umontreal.ca>
449 * emacs-lisp/edebug.el (edebug-eval-defun, edebug-eval):
450 * emacs-lisp/lisp-mode.el (eval-last-sexp-1, eval-defun-1):
451 * ielm.el (ielm-eval-input):
452 * simple.el (eval-expression): Use new eval arg to obey lexical-binding.
454 2010-12-14 Stefan Monnier <monnier@iro.umontreal.ca>
456 * emacs-lisp/bytecomp.el (byte-compile-condition-case): Use push.
458 2010-12-13 Stefan Monnier <monnier@iro.umontreal.ca>
460 * subr.el (with-lexical-binding): Remove.
462 2010-06-18 Stefan Monnier <monnier@iro.umontreal.ca>
464 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
465 specialp -> special-variable-p.
467 2010-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
469 * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
470 Don't macroexpand before evaluating in eval-and-compile, in case
471 `body's macro expansion uses macros and functions defined in itself.
473 2010-06-14 Stefan Monnier <monnier@iro.umontreal.ca>
475 * emacs-lisp/bytecomp.el (byte-compile-check-variable):
476 Update byte-compile-not-obsolete-var to byte-compile-not-obsolete-vars.
478 * Makefile.in (.el.elc): Increase max-lisp-eval-depth.
480 2006-12-04 Miles Bader <miles@gnu.org>
482 * Makefile.in (COMPILE_FIRST_STACK_DEPTH): New variable.
483 (compile, compile-always): Use it.
485 2005-10-24 Miles Bader <miles@gnu.org>
487 * subr.el (functionp): Re-remove.
489 * emacs-lisp/bytecomp.el (byte-compile-closure): Add optional
490 ADD-LAMBDA argument, which we just pass to `byte-compile-lambda'.
491 (byte-compile-defun): Use ADD-LAMBDA arg to `byte-compile-closure'
492 instead of adding lambda ourselves.
494 2004-08-09 Miles Bader <miles@gnu.org>
496 Changes from merging the funvec patch:
498 * emacs-lisp/bytecomp.el (byte-compile-make-closure): Use `curry'
499 instead of `vector' to create compiled closures.
503 2004-05-20 Miles Bader <miles@gnu.org>
505 * subr.el (functionp): Use `funvecp' instead of
506 `byte-compiled-function-p'.
507 * help-fns.el (describe-function-1): Describe curried functions
508 and other funvecs as such.
509 (help-highlight-arguments): Only format things that look like a
512 2004-04-29 Miles Bader <miles@gnu.org>
514 * emacs-lisp/bytecomp.el (byte-compile-top-level): Add new entries
515 to `byte-compile-lexical-environment' at the start, not end.
516 (byte-compile-delay-out): Correctly default STACK-ADJUST to zero.
518 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params):
519 Don't crash on no-op lapcode entries (car is nil).
521 * emacs-lisp/byte-lexbind.el (byte-compile-make-lambda-lexenv):
522 Push a lexvar onto lexenv, not a vinfo!
524 2004-04-11 Miles Bader <miles@gnu.org>
526 * emacs-lisp/bytecomp.el (byte-compile-top-level):
527 Correctly analyze lexically-bound arguments.
529 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
530 Use `append' instead of `nconc'.
532 * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo):
533 Don't use backquote to make a mutable data-structure.
534 (byte-compile-lvarinfo-num-refs, byte-compile-lvarinfo-num-sets):
535 Rename to use `num-' instead of `num'.
536 (byte-compile-make-lambda-lexenv): Adjust accordingly.
538 2004-04-10 Miles Bader <miles@gnu.org>
540 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
541 Look at variable's global specialp state too.
543 2004-04-09 Miles Bader <miles@gnu.org>
545 * emacs-lisp/byte-opt.el (byte-optimize-lapcode):
546 Default initial-stack-depth to 0.
547 (byte-optimize-lapcode): Discard the right number of values in
548 the stack-set+discard-->discard optimization.
550 2004-04-02 Miles Bader <miles@gnu.org>
552 * emacs-lisp/lisp-mode.el (eval-last-sexp-1): Setup the lexical
553 environment if lexical-binding is enabled.
555 2003-10-14 Miles Bader <miles@gnu.org>
557 * emacs-lisp/macroexp.el (macroexpand-all-1): Special-case
558 `backquote-list*' to avoid stack overflows.
560 2003-04-04 Miles Bader <miles@gnu.org>
562 * help-fns.el (help-function-arglist): Handle interpreted closures.
564 2002-11-20 Miles Bader <miles@gnu.org>
566 * emacs-lisp/bytecomp.el (byte-compile-stack-adjustment):
567 Correctly handle discardN* operators.
568 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Fix stack-depth
571 2002-08-26 Miles Bader <miles@gnu.org>
573 * international/mule.el (make-char): Macroexpand call to
574 charset-id constructed by `byte-compile' hook.
576 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defconst value.
578 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params): New macro.
579 (byte-optimize-lapcode): Keep track of stack-depth in final pass too.
580 Add more optimizations for lexical binding.
581 (byte-compile-inline-expand): Macroexpand result of inlining.
583 * emacs-lisp/bytecomp.el (byte-compile-lambda): Update call to
584 byte-compile-closure-initial-lexenv-p.
585 (byte-discardN-preserve-tos): Alias to byte-discardN.
586 (byte-compile-push-binding-init): Don't push unused variables on
588 (byte-compile-push-binding-init): Don't use LFORMINFO if it's nil.
589 (byte-compile-lambda): Don't look at lexical environment unless
590 we're using lexical binding.
591 (byte-compile-defmacro): Correctly generate macros.
593 * emacs-lisp/byte-lexbind.el (byte-compile-unbind): Optimize the
594 dynamic-bindings-only case.
595 (byte-compile-bind): Don't special-case unused lexical variables.
597 * emacs-lisp/disass.el (disassemble-1): Print arg for discardN ops.
599 2002-08-19 Miles Bader <miles@gnu.org>
601 * emacs-lisp/byte-opt.el (byte-decompile-bytecode-1):
602 Handle `byte-discardN-preserve-tos' pseudo-op.
603 (byte-compile-side-effect-and-error-free-ops): Add `byte-stack-ref'.
604 (byte-compile-side-effect-free-ops): Add `byte-vec-ref'.
605 (byte-optimize-lapcode): Add some cases for stack-set/ref ops.
606 Add tracking of stack-depth. Unfinished code to collapse
607 lexical-unbinding sequences.
609 * emacs-lisp/bytecomp.el (byte-compile-lapcode):
610 Handle `byte-discardN-preserve-tos' pseudo-op.
611 (byte-compile-top-level): If there are lexical args, output a TAG
612 op to record the initial stack-depth for the optimizer.
614 2002-08-17 Miles Bader <miles@gnu.org>
616 * emacs-lisp/bytecomp.el (byte-discardN): Add byte-defop.
617 (byte-compile-lapcode): Include byte-discardN.
618 (byte-compile-lambda): Fixup closure detection.
619 (byte-compile-top-level): Handle arguments for a lexical lambda.
620 (byte-compile-lexical-variable-ref, byte-compile-variable-ref)
621 (byte-compile-variable-set): Use byte-compile-stack-set/ref.
622 (byte-compile-discard): Add new parameters NUM and PRESERVE-TOS.
623 (byte-compile-stack-ref, byte-compile-stack-set): New functions.
624 (byte-compile-push-binding-init): Get the variable list properly
627 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
628 Ignore setq'd variables we're not interested in.
629 (byte-compile-make-lambda-lexenv): Add assertion that closed-over
630 variables be heap allocated.
631 (byte-compile-closure-initial-lexenv-p): Rename from
632 byte-compile-closure-lexenv-p.
633 (byte-compile-non-stack-bindings-p): Get the variable list
634 properly from LFORMINFO.
635 (byte-compile-maybe-push-heap-environment): Handle the
636 no-closed-over-variables case correctly.
637 (byte-compile-bind): Use byte-compile-stack-set/ref.
638 Don't bother modifying INIT-LEXENV as no one will see the changes.
639 (byte-compile-unbind): Call `byte-compile-discard' to handle
640 unbinding lexical bindings.
642 * emacs-lisp/disass.el (disassemble-internal): Handle closures.
643 (disassemble-1): Handle new bytecodes.
644 * emacs-lisp/byte-opt.el (disassemble-offset): Handle new bytecodes.
646 2002-06-16 Miles Bader <miles@gnu.org>
648 * emacs-lisp/macroexp.el (macroexp-accumulate): New macro.
649 (macroexpand-all-forms, macroexpand-all-clauses): Use it.
650 * Makefile.in (compile): Undo previous change.
652 2002-06-14 Miles Bader <miles@gnu.org>
654 * Makefile.in (COMPILE_FIRST): Add `emacs-lisp/macroexp.el'.
655 (compile): Add a special case that compiles `emacs-lisp/macroexp.el'
656 with an increased max-lisp-eval-depth.
658 * emacs-lisp/bytecomp.el: Provide `bytecomp-preload', at the
659 beginning of the file. Require `byte-lexbind' at compile time.
660 Add a few doc string.
661 (byte-compile-push-bytecodes)
662 (byte-compile-push-bytecode-const2): New macros.
663 (byte-compile-lapcode): Use them. Do general code cleanup.
664 (byte-compile-initial-macro-environment): Expand macros in
665 byte-compile-eval before passing to byte-compile-top-level.
666 (byte-compile): Use the `byte-compile-initial-macro-environment'.
668 * emacs-lisp/byte-lexbind.el: Require `bytecomp-preload' instead of
670 (byte-compile-bind): Use `byte-compile-dynamic-variable-bind' to bind
672 (byte-compile-maybe-push-heap-environment): Fix function name typo.
674 2002-06-13 Miles Bader <miles@gnu.org>
676 Byte compiler lexical binding support (not finished yet):
677 * emacs-lisp/bytecomp.el: Require `macroexp'.
678 (byte-compile-lexical-environment)
679 (byte-compile-current-heap-environment)
680 (byte-compile-current-num-closures): New variables.
681 (0, 178, 179, 180, 181): New byte-opcodes.
682 (byte-compile-lapcode): Handle stack-ref/set opcodes. Signal an
683 error if a delay-output placeholder is not filled in yet.
684 (byte-compile-file-form, byte-compile): Expand all macros with
686 (byte-compile-file-form-defsubst, byte-compile-form): Don't expand
688 (byte-compile-make-lambda-lexenv): Autoload.
689 (byte-compile-lambda): Initial code for handling lexically-bound
690 arguments and closures; doesn't work yet.
691 (byte-compile-closure-code-p, byte-compile-make-closure)
692 (byte-compile-closure): New functions.
693 (byte-compile-check-variable, byte-compile-dynamic-variable-op)
694 (byte-compile-dynamic-variable-bind)
695 (byte-compile-lexical-variable-ref, byte-compile-variable-set):
697 (byte-compile-variable-ref): Remove second argument. Now only
698 handles real variable references (not setting or binding).
699 (byte-compile-push-unknown-constant)
700 (byte-compile-resolve-unknown-constant): New functions.
701 (byte-compile-funarg, byte-compile-funarg-2): Functions removed.
702 (byte-compile-function-form): Use either `byte-compile-constant'
703 or `byte-compile-closure'.
704 (byte-compile-setq): Use `byte-compile-variable-set' instead of
705 `byte-compile-variable-ref'.
706 (apply, mapcar, mapatoms, mapconcat, mapc, sort):
707 `byte-defop-compiler-1's removed.
708 (byte-compile-while): Make sure lexically-bound variables inside
709 the loop don't get stored in an environment outside the loop.
710 (byte-compile-compute-lforminfo): Autoload.
711 (byte-compile-push-binding-init): New function.
712 (byte-compile-let, byte-compile-let*): Handle lexical binding.
713 (byte-compile-defun): Use `byte-compile-closure' to do the work.
714 (byte-compile-defmacro): Use `byte-compile-make-closure'.
715 (byte-compile-defvar): Expand the generated call to `push' since
716 we're past macroexpansion already.
717 (byte-compile-stack-adjustment): New function.
718 (byte-compile-out): Make second arg optional. Rewrite for clarity.
719 (byte-compile-delay-out, byte-compile-delayed-out): New functions.
721 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
722 Don't expand macros here.
724 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defmacro forms.
726 * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo)
727 (byte-compile-lforminfo-add-var)
728 (byte-compile-lforminfo-note-closure)
729 (byte-compile-compute-lforminfo)
730 (byte-compile-lforminfo-from-lambda)
731 (byte-compile-lforminfo-analyze)
732 (byte-compile-heapenv-add-accessible-env)
733 (byte-compile-heapenv-ensure-access)
734 (byte-compile-rearrange-let-clauses, byte-compile-bind)
735 (byte-compile-unbind): Fix a bunch of typos.
737 2002-06-12 Miles Bader <miles@gnu.org>
739 * emacs-lisp/byte-lexbind.el, emacs-lisp/macroexp.el: New files.
741 * subr.el (functionp): Function removed (now a subr).
742 * help-fns.el (describe-function-1): Handle interpreted closures.
744 ;; arch-tag: bd1b5b8b-fdb2-425d-9ac2-20689fb0ee70