Merge from trunk
[bpt/emacs.git] / lisp / ChangeLog
CommitLineData
295fb2ac
SM
12011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
2
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.
8
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.
14
15 * emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth
16 before using it.
17
18 * dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as
19 function argument.
20
43e67019
SM
212011-02-11 Stefan Monnier <monnier@iro.umontreal.ca>
22
23 * emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
24 renamed to `bytecomp-fun'.
25
26 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
27 Understand the :fun-body case for catch, save-window-excursion, and
28 condition-case.
29 (byte-compile-maybe-push-heap-environment): No need when nclosures is
30 zero and byte-compile-current-num-closures is -1.
31
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.
42
d779e73c
SM
432011-02-10 Stefan Monnier <monnier@iro.umontreal.ca>
44
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
48 condition-case.
49
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.
55
94d11cb5
IK
562011-02-10 Igor Kuzmin <kuzminig@iro.umontreal.ca>
57
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.
62 * server.el:
63 * mpc.el:
64 * emacs-lisp/pcase.el:
65 * doc-view.el:
66 * dired.el: Use lexical-binding.
67
590130fb
SM
682010-12-27 Stefan Monnier <monnier@iro.umontreal.ca>
69
70 * emacs-lisp/bytecomp.el (byte-compile-track-mouse): Don't use #'.
71
a0ee6f27
SM
722010-12-15 Stefan Monnier <monnier@iro.umontreal.ca>
73
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.
78
defb1411
SM
792010-12-14 Stefan Monnier <monnier@iro.umontreal.ca>
80
81 * emacs-lisp/bytecomp.el (byte-compile-condition-case): Use push.
82
f07a954e
SM
832010-12-13 Stefan Monnier <monnier@iro.umontreal.ca>
84
85 * subr.el (with-lexical-binding): Remove.
86
4a330052
SM
872010-06-18 Stefan Monnier <monnier@iro.umontreal.ca>
88
89 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
90 specialp -> special-variable-p.
91
3c3ddb98
SM
922010-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
93
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.
97
f43cb649
SM
982010-06-14 Stefan Monnier <monnier@iro.umontreal.ca>
99
100 * emacs-lisp/bytecomp.el (byte-compile-check-variable):
101 Update byte-compile-not-obsolete-var to byte-compile-not-obsolete-vars.
102
103 * Makefile.in (.el.elc): Increase max-lisp-eval-depth.
104
894e369d 1052006-12-04 Miles Bader <miles@gnu.org>
89877f5f 106
894e369d
SM
107 * Makefile.in (COMPILE_FIRST_STACK_DEPTH): New variable.
108 (compile, compile-always): Use it.
133a8d82 109
894e369d 1102005-10-24 Miles Bader <miles@gnu.org>
89877f5f 111
894e369d 112 * subr.el (functionp): Re-remove.
89877f5f 113
894e369d
SM
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.
9d1f18b5 118
894e369d 1192004-08-09 Miles Bader <miles@gnu.org>
9d1f18b5 120
894e369d 121 Changes from merging the funvec patch:
b81a0b56 122
894e369d
SM
123 * emacs-lisp/bytecomp.el (byte-compile-make-closure): Use `curry'
124 instead of `vector' to create compiled closures.
b81a0b56 125
894e369d 126 Merge funvec patch.
b81a0b56 127
894e369d 1282004-04-29 Miles Bader <miles@gnu.org>
69f18acc 129
894e369d
SM
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.
5fee75d4 133
894e369d
SM
134 * emacs-lisp/byte-opt.el (byte-opt-update-stack-params):
135 Don't crash on no-op lapcode entries (car is nil).
69f18acc 136
894e369d
SM
137 * emacs-lisp/byte-lexbind.el (byte-compile-make-lambda-lexenv):
138 Push a lexvar onto lexenv, not a vinfo!
9766adfb 139
894e369d 1402004-04-11 Miles Bader <miles@gnu.org>
9766adfb 141
894e369d
SM
142 * emacs-lisp/bytecomp.el (byte-compile-top-level):
143 Correctly analyze lexically-bound arguments.
9766adfb 144
894e369d
SM
145 * emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
146 Use `append' instead of `nconc'.
56b2854f 147
894e369d
SM
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.
56b2854f 153
894e369d 1542004-04-10 Miles Bader <miles@gnu.org>
6534e58a 155
894e369d
SM
156 * emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
157 Look at variable's global specialp state too.
d6ceb380 158
894e369d 1592004-04-09 Miles Bader <miles@gnu.org>
d6ceb380 160
894e369d
SM
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.
c760f19e 165
894e369d 1662004-04-02 Miles Bader <miles@gnu.org>
2e9b968b 167
894e369d
SM
168 * emacs-lisp/lisp-mode.el (eval-last-sexp-1): Setup the lexical
169 environment if lexical-binding is enabled.
2e9b968b 170
894e369d 1712003-10-14 Miles Bader <miles@gnu.org>
6d00ce04 172
894e369d
SM
173 * emacs-lisp/macroexp.el (macroexpand-all-1): Special-case
174 `backquote-list*' to avoid stack overflows.
baf1a55e 175
894e369d 1762003-04-04 Miles Bader <miles@gnu.org>
6ee21b07 177
894e369d 178 * help-fns.el (help-function-arglist): Handle interpreted closures.
f0dbdc25 179
894e369d 1802002-11-20 Miles Bader <miles@gnu.org>
f0dbdc25 181
894e369d
SM
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
185 tracking errors.
e044e4fc 186
894e369d 1872002-08-26 Miles Bader <miles@gnu.org>
e044e4fc 188
894e369d
SM
189 * international/mule.el (make-char): Macroexpand call to
190 charset-id constructed by `byte-compile' hook.
2e9b968b 191
894e369d 192 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defconst value.
2e9b968b 193
894e369d
SM
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.
baf1a55e 198
894e369d
SM
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
203 init-lexenv.
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.
208
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.
212
213 * emacs-lisp/disass.el (disassemble-1): Print arg for discardN ops.
214
2152002-08-19 Miles Bader <miles@gnu.org>
216
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.
224
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.
229
2302002-08-17 Miles Bader <miles@gnu.org>
231
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
241 from LFORMINFO.
242
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.
257
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.
261
2622002-06-16 Miles Bader <miles@gnu.org>
263
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.
267
2682002-06-14 Miles Bader <miles@gnu.org>
269
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.
273
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'.
283
284 * emacs-lisp/byte-lexbind.el: Require `bytecomp-preload' instead of
285 `bytecomp'.
286 (byte-compile-bind): Use `byte-compile-dynamic-variable-bind' to bind
287 dynamic variables.
288 (byte-compile-maybe-push-heap-environment): Fix function name typo.
289
2902002-06-13 Miles Bader <miles@gnu.org>
291
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
301 `macroexpand-all'.
302 (byte-compile-file-form-defsubst, byte-compile-form): Don't expand
303 macros here.
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):
baf1a55e 312 New functions.
894e369d
SM
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.
336
337 * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
338 Don't expand macros here.
339
340 * emacs-lisp/macroexp.el (macroexpand-all-1): Expand defmacro forms.
341
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.
352
3532002-06-12 Miles Bader <miles@gnu.org>
354
355 * emacs-lisp/byte-lexbind.el, emacs-lisp/macroexp.el: New files.
356
357 * subr.el (functionp): Function removed (now a subr).
358 * help-fns.el (describe-function-1): Handle interpreted closures.
359
360;; arch-tag: bd1b5b8b-fdb2-425d-9ac2-20689fb0ee70