1 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
3 * emacs-lisp/cconv.el (cconv-closure-convert): Drop `toplevel' arg.
4 (cconv-closure-convert-toplevel): Remove.
5 (cconv-lookup-let): New fun.
6 (cconv-closure-convert-rec): Don't bother with defs-are-legal.
7 Use :fun-body to handle special forms that require closing their forms.
9 * emacs-lisp/bytecomp.el (byte-compile-file-form, byte-compile):
10 Use cconv-closure-convert instead of cconv-closure-convert-toplevel.
11 (byte-compile-lambda, byte-compile-make-closure):
12 * emacs-lisp/byte-lexbind.el (byte-compile-maybe-push-heap-environment):
13 Make sure cconv did its job.
15 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth
18 * dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as
21 2011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
23 * emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
24 renamed to `bytecomp-fun'.
26 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
27 Understand the :fun-body case for catch, save-window-excursion, and
29 (byte-compile-maybe-push-heap-environment): No need when nclosures is
30 zero and byte-compile-current-num-closures is -1.
32 * emacs-lisp/cconv.el (cconv-not-lexical-var-p): New function.
33 (cconv-freevars): Use it.
34 (cconv-closure-convert-rec): Avoid `position'.
35 (cconv-analyse-function): New function.
36 (cconv-analyse-form): Use it. `inclosure' can't be nil any more.
37 Check lexical vars at let-binding time rather than when referenced.
38 For defuns to be in an empty environment and lambdas to take lexical args.
39 Pay attention to the need to build closures in catch, unwind-protect,
40 save-window-excursion, condition-case, and track-mouse.
41 Fix defconst/defvar handling.
43 2011-02-10 Stefan Monnier <monnier@iro.umontreal.ca>
45 * emacs-lisp/cconv.el (cconv-mutated, cconv-captured)
46 (cconv-captured+mutated, cconv-lambda-candidates): Fix up declaration.
47 (cconv-freevars): Minor cleanup. Fix handling of the error var in
50 * emacs-lisp/bytecomp.el (byte-compile-catch)
51 (byte-compile-unwind-protect, byte-compile-track-mouse)
52 (byte-compile-condition-case, byte-compile-save-window-excursion):
53 Provide a :fun-body alternative, so that info can be propagated from the
54 surrounding context, as is the case for lexical scoping.
56 2011-02-10 Igor Kuzmin <kuzminig@iro.umontreal.ca>
58 * emacs-lisp/cconv.el: New file.
59 * emacs-lisp/bytecomp.el: Use cconv.
60 (byte-compile-file-form, byte-compile):
61 Call cconv-closure-convert-toplevel when requested.
64 * emacs-lisp/pcase.el:
66 * dired.el: Use lexical-binding.
68 2010-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
70 * emacs-lisp/bytecomp.el (byte-compile-track-mouse): Don't use #'.
72 2010-12-15 Stefan Monnier <monnier@iro.umontreal.ca>
74 * emacs-lisp/edebug.el (edebug-eval-defun, edebug-eval):
75 * emacs-lisp/lisp-mode.el (eval-last-sexp-1, eval-defun-1):
76 * ielm.el (ielm-eval-input):
77 * simple.el (eval-expression): Use new eval arg to obey lexical-binding.
79 2010-12-14 Stefan Monnier <monnier@iro.umontreal.ca>
81 * emacs-lisp/bytecomp.el (byte-compile-condition-case): Use push.
83 2010-12-13 Stefan Monnier <monnier@iro.umontreal.ca>
85 * subr.el (with-lexical-binding): Remove.
87 2010-06-18 Stefan Monnier <monnier@iro.umontreal.ca>
89 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
90 specialp -> special-variable-p.
92 2010-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
94 * emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
95 Don't macroexpand before evaluating in eval-and-compile, in case
96 `body's macro expansion uses macros and functions defined in itself.
98 2010-06-14 Stefan Monnier <monnier@iro.umontreal.ca>
100 * emacs-lisp/bytecomp.el (byte-compile-check-variable):
101 Update byte-compile-not-obsolete-var to byte-compile-not-obsolete-vars.
103 * Makefile.in (.el.elc): Increase max-lisp-eval-depth.
105 2006-12-04 Miles Bader <miles@gnu.org>
107 * Makefile.in (COMPILE_FIRST_STACK_DEPTH): New variable.
108 (compile, compile-always): Use it.
110 2005-10-24 Miles Bader <miles@gnu.org>
112 * subr.el (functionp): Re-remove.
114 * emacs-lisp/bytecomp.el (byte-compile-closure): Add optional
115 ADD-LAMBDA argument, which we just pass to `byte-compile-lambda'.
116 (byte-compile-defun): Use ADD-LAMBDA arg to `byte-compile-closure'
117 instead of adding lambda ourselves.
119 2004-08-09 Miles Bader <miles@gnu.org>
121 Changes from merging the funvec patch:
123 * emacs-lisp/bytecomp.el (byte-compile-make-closure): Use `curry'
124 instead of `vector' to create compiled closures.
128 2004-04-29 Miles Bader <miles@gnu.org>
130 * emacs-lisp/bytecomp.el (byte-compile-top-level): Add new entries
131 to `byte-compile-lexical-environment' at the start, not end.
132 (byte-compile-delay-out): Correctly default STACK-ADJUST to zero.
134 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params):
135 Don't crash on no-op lapcode entries (car is nil).
137 * emacs-lisp/byte-lexbind.el (byte-compile-make-lambda-lexenv):
138 Push a lexvar onto lexenv, not a vinfo!
140 2004-04-11 Miles Bader <miles@gnu.org>
142 * emacs-lisp/bytecomp.el (byte-compile-top-level):
143 Correctly analyze lexically-bound arguments.
145 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
146 Use `append' instead of `nconc'.
148 * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo):
149 Don't use backquote to make a mutable data-structure.
150 (byte-compile-lvarinfo-num-refs, byte-compile-lvarinfo-num-sets):
151 Rename to use `num-' instead of `num'.
152 (byte-compile-make-lambda-lexenv): Adjust accordingly.
154 2004-04-10 Miles Bader <miles@gnu.org>
156 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
157 Look at variable's global specialp state too.
159 2004-04-09 Miles Bader <miles@gnu.org>
161 * emacs-lisp/byte-opt.el (byte-optimize-lapcode):
162 Default initial-stack-depth to 0.
163 (byte-optimize-lapcode): Discard the right number of values in
164 the stack-set+discard-->discard optimization.
166 2004-04-02 Miles Bader <miles@gnu.org>
168 * emacs-lisp/lisp-mode.el (eval-last-sexp-1): Setup the lexical
169 environment if lexical-binding is enabled.
171 2003-10-14 Miles Bader <miles@gnu.org>
173 * emacs-lisp/macroexp.el (macroexpand-all-1): Special-case
174 `backquote-list*' to avoid stack overflows.
176 2003-04-04 Miles Bader <miles@gnu.org>
178 * help-fns.el (help-function-arglist): Handle interpreted closures.
180 2002-11-20 Miles Bader <miles@gnu.org>
182 * emacs-lisp/bytecomp.el (byte-compile-stack-adjustment):
183 Correctly handle discardN* operators.
184 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Fix stack-depth
187 2002-08-26 Miles Bader <miles@gnu.org>
189 * international/mule.el (make-char): Macroexpand call to
190 charset-id constructed by `byte-compile' hook.
192 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defconst value.
194 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params): New macro.
195 (byte-optimize-lapcode): Keep track of stack-depth in final pass too.
196 Add more optimizations for lexical binding.
197 (byte-compile-inline-expand): Macroexpand result of inlining.
199 * emacs-lisp/bytecomp.el (byte-compile-lambda): Update call to
200 byte-compile-closure-initial-lexenv-p.
201 (byte-discardN-preserve-tos): Alias to byte-discardN.
202 (byte-compile-push-binding-init): Don't push unused variables on
204 (byte-compile-push-binding-init): Don't use LFORMINFO if it's nil.
205 (byte-compile-lambda): Don't look at lexical environment unless
206 we're using lexical binding.
207 (byte-compile-defmacro): Correctly generate macros.
209 * emacs-lisp/byte-lexbind.el (byte-compile-unbind): Optimize the
210 dynamic-bindings-only case.
211 (byte-compile-bind): Don't special-case unused lexical variables.
213 * emacs-lisp/disass.el (disassemble-1): Print arg for discardN ops.
215 2002-08-19 Miles Bader <miles@gnu.org>
217 * emacs-lisp/byte-opt.el (byte-decompile-bytecode-1):
218 Handle `byte-discardN-preserve-tos' pseudo-op.
219 (byte-compile-side-effect-and-error-free-ops): Add `byte-stack-ref'.
220 (byte-compile-side-effect-free-ops): Add `byte-vec-ref'.
221 (byte-optimize-lapcode): Add some cases for stack-set/ref ops.
222 Add tracking of stack-depth. Unfinished code to collapse
223 lexical-unbinding sequences.
225 * emacs-lisp/bytecomp.el (byte-compile-lapcode):
226 Handle `byte-discardN-preserve-tos' pseudo-op.
227 (byte-compile-top-level): If there are lexical args, output a TAG
228 op to record the initial stack-depth for the optimizer.
230 2002-08-17 Miles Bader <miles@gnu.org>
232 * emacs-lisp/bytecomp.el (byte-discardN): Add byte-defop.
233 (byte-compile-lapcode): Include byte-discardN.
234 (byte-compile-lambda): Fixup closure detection.
235 (byte-compile-top-level): Handle arguments for a lexical lambda.
236 (byte-compile-lexical-variable-ref, byte-compile-variable-ref)
237 (byte-compile-variable-set): Use byte-compile-stack-set/ref.
238 (byte-compile-discard): Add new parameters NUM and PRESERVE-TOS.
239 (byte-compile-stack-ref, byte-compile-stack-set): New functions.
240 (byte-compile-push-binding-init): Get the variable list properly
243 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
244 Ignore setq'd variables we're not interested in.
245 (byte-compile-make-lambda-lexenv): Add assertion that closed-over
246 variables be heap allocated.
247 (byte-compile-closure-initial-lexenv-p): Rename from
248 byte-compile-closure-lexenv-p.
249 (byte-compile-non-stack-bindings-p): Get the variable list
250 properly from LFORMINFO.
251 (byte-compile-maybe-push-heap-environment): Handle the
252 no-closed-over-variables case correctly.
253 (byte-compile-bind): Use byte-compile-stack-set/ref.
254 Don't bother modifying INIT-LEXENV as no one will see the changes.
255 (byte-compile-unbind): Call `byte-compile-discard' to handle
256 unbinding lexical bindings.
258 * emacs-lisp/disass.el (disassemble-internal): Handle closures.
259 (disassemble-1): Handle new bytecodes.
260 * emacs-lisp/byte-opt.el (disassemble-offset): Handle new bytecodes.
262 2002-06-16 Miles Bader <miles@gnu.org>
264 * emacs-lisp/macroexp.el (macroexp-accumulate): New macro.
265 (macroexpand-all-forms, macroexpand-all-clauses): Use it.
266 * Makefile.in (compile): Undo previous change.
268 2002-06-14 Miles Bader <miles@gnu.org>
270 * Makefile.in (COMPILE_FIRST): Add `emacs-lisp/macroexp.el'.
271 (compile): Add a special case that compiles `emacs-lisp/macroexp.el'
272 with an increased max-lisp-eval-depth.
274 * emacs-lisp/bytecomp.el: Provide `bytecomp-preload', at the
275 beginning of the file. Require `byte-lexbind' at compile time.
276 Add a few doc string.
277 (byte-compile-push-bytecodes)
278 (byte-compile-push-bytecode-const2): New macros.
279 (byte-compile-lapcode): Use them. Do general code cleanup.
280 (byte-compile-initial-macro-environment): Expand macros in
281 byte-compile-eval before passing to byte-compile-top-level.
282 (byte-compile): Use the `byte-compile-initial-macro-environment'.
284 * emacs-lisp/byte-lexbind.el: Require `bytecomp-preload' instead of
286 (byte-compile-bind): Use `byte-compile-dynamic-variable-bind' to bind
288 (byte-compile-maybe-push-heap-environment): Fix function name typo.
290 2002-06-13 Miles Bader <miles@gnu.org>
292 Byte compiler lexical binding support (not finished yet):
293 * emacs-lisp/bytecomp.el: Require `macroexp'.
294 (byte-compile-lexical-environment)
295 (byte-compile-current-heap-environment)
296 (byte-compile-current-num-closures): New variables.
297 (0, 178, 179, 180, 181): New byte-opcodes.
298 (byte-compile-lapcode): Handle stack-ref/set opcodes. Signal an
299 error if a delay-output placeholder is not filled in yet.
300 (byte-compile-file-form, byte-compile): Expand all macros with
302 (byte-compile-file-form-defsubst, byte-compile-form): Don't expand
304 (byte-compile-make-lambda-lexenv): Autoload.
305 (byte-compile-lambda): Initial code for handling lexically-bound
306 arguments and closures; doesn't work yet.
307 (byte-compile-closure-code-p, byte-compile-make-closure)
308 (byte-compile-closure): New functions.
309 (byte-compile-check-variable, byte-compile-dynamic-variable-op)
310 (byte-compile-dynamic-variable-bind)
311 (byte-compile-lexical-variable-ref, byte-compile-variable-set):
313 (byte-compile-variable-ref): Remove second argument. Now only
314 handles real variable references (not setting or binding).
315 (byte-compile-push-unknown-constant)
316 (byte-compile-resolve-unknown-constant): New functions.
317 (byte-compile-funarg, byte-compile-funarg-2): Functions removed.
318 (byte-compile-function-form): Use either `byte-compile-constant'
319 or `byte-compile-closure'.
320 (byte-compile-setq): Use `byte-compile-variable-set' instead of
321 `byte-compile-variable-ref'.
322 (apply, mapcar, mapatoms, mapconcat, mapc, sort):
323 `byte-defop-compiler-1's removed.
324 (byte-compile-while): Make sure lexically-bound variables inside
325 the loop don't get stored in an environment outside the loop.
326 (byte-compile-compute-lforminfo): Autoload.
327 (byte-compile-push-binding-init): New function.
328 (byte-compile-let, byte-compile-let*): Handle lexical binding.
329 (byte-compile-defun): Use `byte-compile-closure' to do the work.
330 (byte-compile-defmacro): Use `byte-compile-make-closure'.
331 (byte-compile-defvar): Expand the generated call to `push' since
332 we're past macroexpansion already.
333 (byte-compile-stack-adjustment): New function.
334 (byte-compile-out): Make second arg optional. Rewrite for clarity.
335 (byte-compile-delay-out, byte-compile-delayed-out): New functions.
337 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
338 Don't expand macros here.
340 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defmacro forms.
342 * emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo)
343 (byte-compile-lforminfo-add-var)
344 (byte-compile-lforminfo-note-closure)
345 (byte-compile-compute-lforminfo)
346 (byte-compile-lforminfo-from-lambda)
347 (byte-compile-lforminfo-analyze)
348 (byte-compile-heapenv-add-accessible-env)
349 (byte-compile-heapenv-ensure-access)
350 (byte-compile-rearrange-let-clauses, byte-compile-bind)
351 (byte-compile-unbind): Fix a bunch of typos.
353 2002-06-12 Miles Bader <miles@gnu.org>
355 * emacs-lisp/byte-lexbind.el, emacs-lisp/macroexp.el: New files.
357 * subr.el (functionp): Function removed (now a subr).
358 * help-fns.el (describe-function-1): Handle interpreted closures.
360 ;; arch-tag: bd1b5b8b-fdb2-425d-9ac2-20689fb0ee70