ChangeLog 32.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
2011-03-23  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/bytecomp.el (byte-compile-file-form-defmumble):
	byte-compile-lambda now always returns a byte-code-function.
	(byte-compile-byte-code-maker, byte-compile-byte-code-unmake)
	(byte-compile-closure): Remove.
	(byte-compile-lambda): Always return a byte-code-function.
	(byte-compile-top-level): Don't handle `byte-code' forms specially.
	(byte-compile-inline-lapcode): New function, taken from byte-opt.el.
	(byte-compile-unfold-bcf): New function.
	(byte-compile-form): Use it to optimize inline byte-code-functions.
	(byte-compile-function-form, byte-compile-defun): Simplify.
	(byte-compile-defmacro): Don't bother calling
	byte-compile-byte-code-maker.
	* emacs-lisp/byte-opt.el (byte-inline-lapcode): Move to bytecomp.el.
	(byte-compile-inline-expand): Inline all bytecompiled functions.
	Unify the inlining code of the lexbind and dynbind interpreted
	functions.
	(byte-compile-unfold-lambda): Don't handle byte-compiled functions
	at all.
	(byte-optimize-form-code-walker): Don't optimize byte-compiled inlined
	functions here.
	(byte-compile-splice-in-already-compiled-code): Remove.
	(byte-code): Don't optimize it any more.
	(byte-decompile-bytecode-1): Remove unused bytedecomp-bytes.
	Leave `byte-return's even for `make-spliceable'.

28 29 30 31 32
2011-03-20  Christian Ohler  <ohler@gnu.org>

	* emacs-lisp/cl-macs.el (cl-block-wrapper): Fix typo that broke CL
	blocks.

33 34 35 36 37
2011-03-20  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/debug.el (debugger-setup-buffer): Revert local change to
	print depth and length.

38 39 40 41 42 43 44 45
2011-03-19  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/cl-macs.el (cl-byte-compile-block, cl-block-wrapper)
	(cl-block-throw, cl-byte-compile-throw): Use a compiler-macro rather
	than a `byte-compile' hook to optimize away unused CL blocks, so that
	also works for lexbind code.
	Move the code after define-compiler-macro.

46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
2011-03-16  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/pcase.el (pcase-mutually-exclusive-predicates):
	Add byte-code-function-p.
	(pcase--u1): Remove left-over code from early development.
	Fix case of variable shadowing in guards and predicates.
	(pcase--u1): Add a new `let' pattern.

	* emacs-lisp/bytecomp.el: Remove the bytecomp- prefix now that we use
	lexical-binding.
	(byte-compile-outbuffer): Rename from bytecomp-outbuffer.
	* emacs-lisp/cl-macs.el (load-time-value):
	* emacs-lisp/cl.el (cl-compiling-file): Adjust to new name.

	* emacs-lisp/byte-opt.el (byte-compile-inline-expand): Make it work to
	inline lexbind interpreted functions into lexbind code.
	(bytedecomp-bytes): Not a dynamic var any more.
	(disassemble-offset): Get the bytes via an argument instead.
	(byte-decompile-bytecode-1): Use push.

66 67 68 69 70
2011-03-15  Stefan Monnier  <monnier@iro.umontreal.ca>

	* makefile.w32-in (COMPILE_FIRST): Fix up last change.
	* ldefs-boot.el: Revert to upstream's version.

71 72 73 74 75 76 77
2011-03-13  Stefan Monnier  <monnier@iro.umontreal.ca>

	* help-fns.el (help-function-arglist):
	* emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
	* subr.el (apply-partially): Adjust to new format.
	* emacs-lisp/disass.el (disassemble-internal): Catch closures.

78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
2011-03-12  Stefan Monnier  <monnier@iro.umontreal.ca>

	* subr.el (apply-partially): Move from subr.el; don't use lexical-let.
	(eval-after-load): Obey lexical-binding.
	* simple.el (apply-partially): Move to subr.el.
	* makefile.w32-in: Match changes in Makefile.in.
	(BIG_STACK_DEPTH, BIG_STACK_OPTS, BYTE_COMPILE_FLAGS): New vars.
	(.el.elc, compile-CMD, compile-SH, compile-always-CMD)
	(compile-always-SH, compile-calc-CMD, compile-calc-SH): Use them.
	(COMPILE_FIRST): Add pcase, macroexp, and cconv.
	* emacs-lisp/macroexp.el (macroexpand-all-1): Silence warning about
	calling CL's `compiler-macroexpand'.
	* emacs-lisp/bytecomp.el (byte-compile-preprocess): New function.
	(byte-compile-initial-macro-environment)
	(byte-compile-toplevel-file-form, byte-compile, byte-compile-sexp):
	Use it.
	(byte-compile-eval, byte-compile-eval-before-compile):
	Obey lexical-binding.
	(byte-compile--for-effect): Rename from `for-effect'.
	(display-call-tree): Use case.
	* emacs-lisp/byte-opt.el (for-effect): Don't declare as dynamic.
	(byte-optimize-form-code-walker, byte-optimize-form):
	Revert to old arg name.
	* Makefile.in (BYTE_COMPILE_FLAGS): New var.
	(compile-onefile, .el.elc, compile-calc, recompile): Use it.

104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
2011-03-11  Stefan Monnier  <monnier@iro.umontreal.ca>

	* subr.el (letrec): New macro.
	(with-wrapper-hook): Move from simple.el and don't use CL.
	* simple.el (with-wrapper-hook): Move with-wrapper-hook to subr.el.
	* help-fns.el (help-function-arglist): Handle subroutines as well.
	(describe-variable): Use special-variable-p to filter completions.
	* emacs-lisp/macroexp.el (macroexpand-all-1): Don't expand `declare'
	in defmacros.
	* emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form):
	Handle `declare'.
	* emacs-lisp/cl.el (pushnew): Silence unfixable warning.
	* emacs-lisp/cl-macs.el (defstruct, define-compiler-macro):
	Mark unused arg as unused.
	* emacs-lisp/byte-opt.el (byte-optimize-lapcode): Use memq.
	* emacs-lisp/autoload.el (make-autoload): Don't assume the macro's
	first sexp is a list.
	(autoload-generate-file-autoloads): Improve error message.
	* emacs-lisp/advice.el (ad-arglist): Use help-function-arglist
	to understand the new byte-code arg format.
	* vc/smerge-mode.el:
	* vc/log-view.el:
	* vc/log-edit.el:
	* vc/cvs-status.el:
	* uniquify.el:
	* textmodes/css-mode.el:
	* textmodes/bibtex-style.el:
	* reveal.el:
	* newcomment.el:
	* emacs-lisp/smie.el:
	* abbrev.el: Use lexical-binding.

136 137
2011-03-10  Stefan Monnier  <monnier@iro.umontreal.ca>

138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
	* emacs-lisp/bytecomp.el: Use lexical-binding.
	(byte-recompile-directory): Remove unused var `bytecomp-dest'.
	(byte-recompile-file): Use derived-mode-p.
	(byte-compile-from-buffer): Remove arg `bytecomp-filename'.
	Use byte-compile-current-file instead.
	(byte-compile-file): Adjust call accordingly.
	(bytecomp-outbuffer): Move declaration before first use.
	(for-effect): Declare dynamic.
	(byte-compile-file-form-defmumble): Use byte-compile-current-file.
	(byte-compile-top-level, byte-compile-out-toplevel, byte-compile-form):
	Move dyn-binding of for-effect from function argument to let binding.
	(byte-compile-out-toplevel): Don't both passing for-effect to
	byte-optimize-lapcode.
	(byte-compile-top-level-body, byte-compile-body):
	Rename for-effect -> for-effect-arg so it's lexical.

	* subr.el (functionp): Remove, now that it's in src/eval.c.

	* emacs-lisp/byte-opt.el: Use lexical-binding.
157 158 159 160 161 162
	(for-effectm byte-compile-tag-number): Declare dynamic.
	(byte-optimize-form-code-walker, byte-optimize-form): Move dynamic
	binding of for-effect from function argument to let binding.
	(byte-decompile-bytecode-1): Move dynamic binding of bytedecomp-bytes
	from function argument to let binding.

163 164 165 166 167 168 169 170 171 172
	* emacs-lisp/cconv.el (cconv--convert-function): Rename from
	cconv-closure-convert-function.
	(cconv-convert): Rename from cconv-closure-convert-rec.
	(cconv--analyse-use): Rename from cconv-analyse-use.
	(cconv--analyse-function): Rename from cconv-analyse-function.
	(cconv--analyse-use): Change some patterns to silence compiler.
	(cconv-convert, cconv--convert-function): Rewrite.
	* emacs-lisp/byte-opt.el (byte-compile-inline-expand): Adjust check for
	new byte-code representation.

173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
2011-03-06  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/bytecomp.el (byte-compile-arglist-signature):
	Handle integer arglist descriptor.
	(byte-compile-make-args-desc): Make integer arglist descriptor.
	(byte-compile-lambda): Use integer arglist descriptor to mark lexical
	byte-coded functions instead of an extra slot.
	* help-fns.el (help-add-fundoc-usage): Don't add a dummy doc.
	(help-split-fundoc): Return a nil doc if there was no actual doc.
	(help-function-arglist): Generate an arglist from an integer arg-desc.
	* emacs-lisp/pcase.el (pcase--memoize): Rename from pcase-memoize;
	Make only the key weak.
	(pcase): Change the key used in the memoization table, so it does not
	always get GC'd away.
	* emacs-lisp/macroexp.el (macroexpand-all-1): Slight change to the
	pcase pattern to generate slightly better code.

190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
2011-03-01  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/cconv.el (cconv-liftwhen): Increase threshold.
	(cconv-closure-convert-rec): Convert interactive spec in empty lexenv.
	(cconv-analyse-use): Improve unused vars warnings.
	(cconv-analyse-form): Analyze interactive spec in empty lexenv.
	* emacs-lisp/bytecomp.el (byte-compile-lambda): Always byte-compile
	the interactive spec in lexical-binding mode.
	(byte-compile-refresh-preloaded): Don't reload byte-compiler files.
	* custom.el (custom-initialize-default): Use defvar.
	(custom-declare-variable): Set the special-variable-p flag.
	* help-fns.el (help-make-usage): Drop leading underscores.
	* dired.el (dired-revert, dired-make-relative): Mark unused args.
	(dired-unmark-all-files): Remove unused var `query'.
	(dired-overwrite-confirmed): Declare.
	(dired-restore-desktop-buffer): Don't use dynamically scoped arg names.
	* mpc.el: Mark unused args.
	(mpc--faster-toggle): Remove unused var `songnb'.
	* server.el (server-kill-buffer-running): Move before first use.
	* minibuffer.el: Mark unused args.

211 212
2011-02-26  Stefan Monnier  <monnier@iro.umontreal.ca>

213 214 215
	* emacs-lisp/cconv.el (cconv-closure-convert-rec): Fix last change for
	λ-lift candidates that end up not λ-lifted.

216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
	* emacs-lisp/cconv.el: Compute freevars in cconv-analyse.
	(cconv-mutated, cconv-captured): Remove.
	(cconv-captured+mutated, cconv-lambda-candidates): Don't give them
	a global value.
	(cconv-freevars-alist): New var.
	(cconv-freevars): Remove.
	(cconv--lookup-let): Remove.
	(cconv-closure-convert-function): Extract from cconv-closure-convert-rec.
	(cconv-closure-convert-rec): Adjust to above changes.
	(fboundp): New function.
	(cconv-analyse-function, form): Rewrite.
	* emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
	Handle declare-function here.
	(byte-compile-obsolete): Remove.
	(byte-compile-arglist-warn): Check late defsubst here.
	(byte-compile-file-form): Simplify.
	(byte-compile-file-form-defsubst): Remove.
	(byte-compile-macroexpand-declare-function): Rename from
	byte-compile-declare-function, turn it into a macro-expander.
	(byte-compile-normal-call): Check obsolescence.
	(byte-compile-quote-form): Remove.
	(byte-compile-defmacro): Revert to trunk's definition which seems to
	work just as well and handles `declare'.
	* emacs-lisp/byte-run.el (make-obsolete): Don't modify byte-compile.
	* Makefile.in (BIG_STACK_DEPTH): Increase to 1200.
	(compile-onefile): Pass $(BIG_STACK_OPTS) before "-l bytecomp".
	* emacs-lisp/macroexp.el: Use lexbind.
	(macroexpand-all-1): Check macro obsolescence.
	* vc/diff-mode.el: Use lexbind.
	* follow.el (follow-calc-win-end): Simplify.

Stefan Monnier's avatar
Stefan Monnier committed
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
2011-02-25  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/bytecomp.el (byte-compile-lapcode): Handle new form of
	`byte-constant'.
	(byte-compile-close-variables, displaying-byte-compile-warnings):
	Add edebug spec.
	(byte-compile-toplevel-file-form): New fun, split out of
	byte-compile-file-form.
	(byte-compile-from-buffer): Use it to avoid applying cconv
	multiple times.
	(byte-compile): Only strip `function' if it's present.
	(byte-compile-lambda): Add `reserved-csts' argument.
	Use new lexenv arg of byte-compile-top-level.
	(byte-compile-reserved-constants): New var.
	(byte-compile-constants-vector): Obey it.
	(byte-compile-constants-vector): Handle new `byte-constant' form.
	(byte-compile-top-level): Add args `lexenv' and `reserved-csts'.
	(byte-compile-form): Don't check callargs here.
	(byte-compile-normal-call): Do it here instead.
	(byte-compile-push-unknown-constant)
	(byte-compile-resolve-unknown-constant): Remove, unused.
	(byte-compile-make-closure): Use `make-byte-code' rather than `curry',
	putting the environment into the "constant" pool.
	(byte-compile-get-closed-var): Use special byte-constant.
	* emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Handle new
	intermediate special form `internal-make-vector'.
	(byte-optimize-lapcode): Handle new form of `byte-constant'.
	* help-fns.el (describe-function-1): Don't handle funvecs.
	* emacs-lisp/macroexp.el (macroexpand-all-1): Only convert quote to
	function if the content is a lambda expression, not if it's a closure.
	* emacs-lisp/eieio-come.el: Remove.
	* emacs-lisp/eieio.el: Don't require eieio-comp.
	(defmethod): Do a bit more work to find the body and wrap it into
	a function before passing it to eieio-defmethod.
	(eieio-defmethod): New arg `code' for it.
	* emacs-lisp/debug.el (debugger-setup-buffer): Don't hide things in
	debugger backtrace.
	* emacs-lisp/cl-extra.el (cl-macroexpand-all): Use backquotes, and be
	more careful when quoting a function value.
	* emacs-lisp/cconv.el (cconv-freevars): Accept defvar/defconst.
	(cconv-closure-convert-rec): Catch stray `internal-make-closure'.
	* Makefile.in (COMPILE_FIRST): Compile pcase and cconv early.

290 291 292 293 294 295 296 297 298
2011-02-21  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/cconv.el (cconv-closure-convert-rec): Let the byte
	compiler choose the representation of closures.
	(cconv--env-var): Remove.
	* emacs-lisp/bytecomp.el (byte-compile--env-var): New var.
	(byte-compile-make-closure, byte-compile-get-closed-var):
	New functions.

299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
2011-02-21  Stefan Monnier  <monnier@iro.umontreal.ca>

	* subr.el (with-output-to-temp-buffer): New macro.

	* simple.el (count-words-region): Don't use interactive-p.

	* minibuffer.el: Use lexical-binding.  Replace all uses of lexical-let.

	* emacs-lisp/eieio.el (eieio-defgeneric-form-primary-only-one):
	Call byte-compile rather than byte-compile-lambda.

	* emacs-lisp/eieio-comp.el (eieio-byte-compile-file-form-defmethod):
	Rename from byte-compile-file-form-defmethod.
	Don't byte-compile-lambda.
	(eieio-byte-compile-defmethod-param-convert): Rename from
	byte-compile-defmethod-param-convert.

	* emacs-lisp/cl-extra.el (cl-macroexpand-all): Don't assume that the
	value of (function (lambda ...)) is self-quoting.

	* emacs-lisp/cconv.el: Use lexical-binding.
	(cconv--lookup-let): Rename from cconv-lookup-let.
	(cconv-closure-convert-rec): Fix handling of captured+mutated
	arguments in defun/defmacro.

	* emacs-lisp/bytecomp.el (byte-compile-lapcode):
	Turn stack-ref-0 into dup.
	(byte-compile-form): Don't indirect-function since it can signal
	errors.
	(byte-compile-stack-ref, byte-compile-stack-set): Adjust to stack-refs
	being relative to top rather than to bottom in the byte-code.
	(with-output-to-temp-buffer): Remove.
	(byte-compile-with-output-to-temp-buffer): Remove.

	* emacs-lisp/byte-opt.el (byte-compile-side-effect-and-error-free-ops):
	Remove interactive-p.
	(byte-optimize-lapcode): Update optimizations now that stack-refs are
	relative to the top rather than to the bottom.

338 339 340 341 342 343 344 345 346 347 348 349 350
2011-02-19  Stefan Monnier  <monnier@iro.umontreal.ca>

	* subr.el (save-window-excursion): New macro, moved from C.
	* emacs-lisp/lisp-mode.el (save-window-excursion): Don't touch.
	* emacs-lisp/cconv.el (cconv-closure-convert-rec, cconv-analyse-form):
	Don't handle save-window-excursion any more.
	* emacs-lisp/bytecomp.el (interactive-p, save-window-excursion):
	Don't use the byte-code any more.
	(byte-compile-form): Check macro expansion was done.
	(byte-compile-save-window-excursion): Remove.
	* emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
	Ignore save-window-excursion.  Don't macroepand any more.

351 352 353 354 355
2011-02-18  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/pcase.el (pcase--expand, pcase--u, pcase--u1, pcase--q1):
	Avoid destructuring-bind which results in poorer code.

356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
2011-02-17  Stefan Monnier  <monnier@iro.umontreal.ca>

	* files.el (lexical-binding): Add a safe-local-variable property.

	* emacs-lisp/cl-macs.el (cl-byte-compile-block): Disable optimization
	in lexbind, because it needs a different implementation.

	* emacs-lisp/cconv.el (cconv--set-diff, cconv--set-diff-map)
	(cconv--map-diff, cconv--map-diff-elem, cconv--map-diff-set): New funs.
	(cconv--env-var): New constant.
	(cconv-closure-convert-rec): Use it and use them.  Fix a typo that
	ended up forgetting to remove entries from lmenvs in `let'.
	For `lambda' use the outer `fvrs' when building the closure and don't
	forget to remove `vars' from the `emvrs' and `lmenvs' of the body.

	* emacs-lisp/bytecomp.el (byte-compile-arglist-warn):
	Correctly extract arglist from `closure's.
	(byte-compile-cl-warn): Compiler-macros are run earlier now.
	(byte-compile-top-level): Bind byte-compile-lexical-environment to nil,
	except for lambdas.
	(byte-compile-form): Don't run the compiler-macro expander here.
	(byte-compile-let): Merge with byte-compile-let*.
	Don't preserve-body-value if the body's value was discarded.

	* emacs-lisp/byte-opt.el (byte-inline-lapcode): Check how many elements
	are added to the stack.
	(byte-compile-splice-in-already-compiled-code): Don't touch lexical nor
	byte-compile-depth now that byte-inline-lapcode does it for us.
	(byte-compile-inline-expand): Don't inline dynbind byte code into
	lexbind code, since it has to be done differently.

387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
2011-02-12  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/byte-lexbind.el: Delete.

	* emacs-lisp/bytecomp.el (byte-compile-current-heap-environment)
	(byte-compile-current-num-closures): Remove vars.
	(byte-vec-ref, byte-vec-set): Remove byte codes.
	(byte-compile-arglist-vars, byte-compile-make-lambda-lexenv): Move from
	byte-lexbind.el.
	(byte-compile-lambda): Never build a closure.
	(byte-compile-closure-code-p, byte-compile-make-closure): Remove.
	(byte-compile-closure): Simplify.
	(byte-compile-top-level): Don't mess with heap environments.
	(byte-compile-dynamic-variable-bind): Always maintain
	byte-compile-bound-variables.
	(byte-compile-variable-ref, byte-compile-variable-set): Always just use
	the stack for lexical vars.
	(byte-compile-push-binding-init): Simplify.
	(byte-compile-not-lexical-var-p): New function, moved from cconv.el.
	(byte-compile-bind, byte-compile-unbind): New functions, moved and
	simplified from byte-lexbind.el.
	(byte-compile-let, byte-compile-let*): Simplify.
	(byte-compile-condition-case): Don't add :fun-body to the bound vars.
	(byte-compile-defmacro): Simplify.

	* emacs-lisp/cconv.el (cconv-not-lexical-var-p): Remove.
	(cconv-freevars, cconv-analyse-function, cconv-analyse-form):
	Use byte-compile-not-lexical-var-p instead.

	* help-fns.el (describe-function-1): Fix paren typo.

	* emacs-lisp/byte-opt.el (byte-compile-side-effect-free-ops)
	(byte-optimize-lapcode): Remove byte-vec-ref and byte-vec-set.

421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440
2011-02-11  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/cconv.el (cconv-closure-convert): Drop `toplevel' arg.
	(cconv-closure-convert-toplevel): Remove.
	(cconv-lookup-let): New fun.
	(cconv-closure-convert-rec): Don't bother with defs-are-legal.
	Use :fun-body to handle special forms that require closing their forms.

	* emacs-lisp/bytecomp.el (byte-compile-file-form, byte-compile):
	Use cconv-closure-convert instead of cconv-closure-convert-toplevel.
	(byte-compile-lambda, byte-compile-make-closure):
	* emacs-lisp/byte-lexbind.el (byte-compile-maybe-push-heap-environment):
	Make sure cconv did its job.

	* emacs-lisp/byte-opt.el (byte-optimize-lapcode): Check stack-depth
	before using it.

	* dired.el (dired-desktop-buffer-misc-data): Don't use a dynamic var as
	function argument.

441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
2011-02-11  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/bytecomp.el (byte-compile-lambda): Fix `fun' that was not
	renamed to `bytecomp-fun'.

	* emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
	Understand the :fun-body case for catch, save-window-excursion, and
	condition-case.
	(byte-compile-maybe-push-heap-environment): No need when nclosures is
	zero and byte-compile-current-num-closures is -1.

	* emacs-lisp/cconv.el (cconv-not-lexical-var-p): New function.
	(cconv-freevars): Use it.
	(cconv-closure-convert-rec): Avoid `position'.
	(cconv-analyse-function): New function.
	(cconv-analyse-form): Use it.  `inclosure' can't be nil any more.
	Check lexical vars at let-binding time rather than when referenced.
	For defuns to be in an empty environment and lambdas to take lexical args.
	Pay attention to the need to build closures in catch, unwind-protect,
	save-window-excursion, condition-case, and track-mouse.
	Fix defconst/defvar handling.

463 464 465 466 467 468 469 470 471 472 473 474 475
2011-02-10  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/cconv.el (cconv-mutated, cconv-captured)
	(cconv-captured+mutated, cconv-lambda-candidates): Fix up declaration.
	(cconv-freevars): Minor cleanup.  Fix handling of the error var in
	condition-case.

	* emacs-lisp/bytecomp.el (byte-compile-catch)
	(byte-compile-unwind-protect, byte-compile-track-mouse)
	(byte-compile-condition-case, byte-compile-save-window-excursion):
	Provide a :fun-body alternative, so that info can be propagated from the
	surrounding context, as is the case for lexical scoping.

476 477 478 479 480 481 482 483 484 485 486 487
2011-02-10  Igor Kuzmin  <kuzminig@iro.umontreal.ca>

	* emacs-lisp/cconv.el: New file.
	* emacs-lisp/bytecomp.el: Use cconv.
	(byte-compile-file-form, byte-compile):
	Call cconv-closure-convert-toplevel when requested.
	* server.el:
	* mpc.el:
	* emacs-lisp/pcase.el:
	* doc-view.el:
	* dired.el: Use lexical-binding.

488 489 490 491
2010-12-27  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/bytecomp.el (byte-compile-track-mouse): Don't use #'.

492 493 494 495 496 497 498
2010-12-15  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/edebug.el (edebug-eval-defun, edebug-eval):
	* emacs-lisp/lisp-mode.el (eval-last-sexp-1, eval-defun-1):
	* ielm.el (ielm-eval-input):
	* simple.el (eval-expression): Use new eval arg to obey lexical-binding.

499 500 501 502
2010-12-14  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/bytecomp.el (byte-compile-condition-case): Use push.

503 504 505 506
2010-12-13  Stefan Monnier  <monnier@iro.umontreal.ca>

	* subr.el (with-lexical-binding): Remove.

507 508 509 510 511
2010-06-18  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
	specialp -> special-variable-p.

512 513 514 515 516 517
2010-06-15  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
	Don't macroexpand before evaluating in eval-and-compile, in case
	`body's macro expansion uses macros and functions defined in itself.

518 519 520 521 522 523 524
2010-06-14  Stefan Monnier  <monnier@iro.umontreal.ca>

	* emacs-lisp/bytecomp.el (byte-compile-check-variable):
	Update byte-compile-not-obsolete-var to byte-compile-not-obsolete-vars.

	* Makefile.in (.el.elc): Increase max-lisp-eval-depth.

Stefan Monnier's avatar
Stefan Monnier committed
525
2006-12-04  Miles Bader  <miles@gnu.org>
526

Stefan Monnier's avatar
Stefan Monnier committed
527 528
	* Makefile.in (COMPILE_FIRST_STACK_DEPTH): New variable.
	(compile, compile-always): Use it.
529

Stefan Monnier's avatar
Stefan Monnier committed
530
2005-10-24  Miles Bader  <miles@gnu.org>
531

Stefan Monnier's avatar
Stefan Monnier committed
532
	* subr.el (functionp): Re-remove.
533

Stefan Monnier's avatar
Stefan Monnier committed
534 535 536 537
	* emacs-lisp/bytecomp.el (byte-compile-closure): Add optional
	ADD-LAMBDA argument, which we just pass to `byte-compile-lambda'.
	(byte-compile-defun): Use ADD-LAMBDA arg to `byte-compile-closure'
	instead of adding lambda ourselves.
Eli Zaretskii's avatar
Eli Zaretskii committed
538

Stefan Monnier's avatar
Stefan Monnier committed
539
2004-08-09  Miles Bader  <miles@gnu.org>
Eli Zaretskii's avatar
Eli Zaretskii committed
540

Stefan Monnier's avatar
Stefan Monnier committed
541
	Changes from merging the funvec patch:
542

Stefan Monnier's avatar
Stefan Monnier committed
543 544
	* emacs-lisp/bytecomp.el (byte-compile-make-closure): Use `curry'
	instead of `vector' to create compiled closures.
545

Stefan Monnier's avatar
Stefan Monnier committed
546
	Merge funvec patch.
547

548 549 550 551 552 553 554 555 556
2004-05-20  Miles Bader  <miles@gnu.org>

	* subr.el (functionp): Use `funvecp' instead of
	`byte-compiled-function-p'.
	* help-fns.el (describe-function-1): Describe curried functions
	and other funvecs as such.
	(help-highlight-arguments): Only format things that look like a
	function.

Stefan Monnier's avatar
Stefan Monnier committed
557
2004-04-29  Miles Bader  <miles@gnu.org>
558

Stefan Monnier's avatar
Stefan Monnier committed
559 560 561
	* emacs-lisp/bytecomp.el (byte-compile-top-level): Add new entries
	to `byte-compile-lexical-environment' at the start, not end.
	(byte-compile-delay-out): Correctly default STACK-ADJUST to zero.
562

Stefan Monnier's avatar
Stefan Monnier committed
563 564
	* emacs-lisp/byte-opt.el (byte-opt-update-stack-params):
	Don't crash on no-op lapcode entries (car is nil).
565

Stefan Monnier's avatar
Stefan Monnier committed
566 567
	* emacs-lisp/byte-lexbind.el (byte-compile-make-lambda-lexenv):
	Push a lexvar onto lexenv, not a vinfo!
568

Stefan Monnier's avatar
Stefan Monnier committed
569
2004-04-11  Miles Bader  <miles@gnu.org>
570

Stefan Monnier's avatar
Stefan Monnier committed
571 572
	* emacs-lisp/bytecomp.el (byte-compile-top-level):
	Correctly analyze lexically-bound arguments.
573

Stefan Monnier's avatar
Stefan Monnier committed
574 575
	* emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
	Use `append' instead of `nconc'.
576

Stefan Monnier's avatar
Stefan Monnier committed
577 578 579 580 581
	* emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo):
	Don't use backquote to make a mutable data-structure.
	(byte-compile-lvarinfo-num-refs, byte-compile-lvarinfo-num-sets):
	Rename to use `num-' instead of `num'.
	(byte-compile-make-lambda-lexenv): Adjust accordingly.
582

Stefan Monnier's avatar
Stefan Monnier committed
583
2004-04-10  Miles Bader  <miles@gnu.org>
584

Stefan Monnier's avatar
Stefan Monnier committed
585 586
	* emacs-lisp/byte-lexbind.el (byte-compile-compute-lforminfo):
	Look at variable's global specialp state too.
587

Stefan Monnier's avatar
Stefan Monnier committed
588
2004-04-09  Miles Bader  <miles@gnu.org>
589

Stefan Monnier's avatar
Stefan Monnier committed
590 591 592 593
	* emacs-lisp/byte-opt.el (byte-optimize-lapcode):
	Default initial-stack-depth to 0.
	(byte-optimize-lapcode): Discard the right number of values in
	the stack-set+discard-->discard optimization.
594

Stefan Monnier's avatar
Stefan Monnier committed
595
2004-04-02  Miles Bader  <miles@gnu.org>
596

Stefan Monnier's avatar
Stefan Monnier committed
597 598
	* emacs-lisp/lisp-mode.el (eval-last-sexp-1): Setup the lexical
	environment if lexical-binding is enabled.
599

Stefan Monnier's avatar
Stefan Monnier committed
600
2003-10-14  Miles Bader  <miles@gnu.org>
601

Stefan Monnier's avatar
Stefan Monnier committed
602 603
	* emacs-lisp/macroexp.el (macroexpand-all-1): Special-case
	`backquote-list*' to avoid stack overflows.
604

Stefan Monnier's avatar
Stefan Monnier committed
605
2003-04-04  Miles Bader  <miles@gnu.org>
606

Stefan Monnier's avatar
Stefan Monnier committed
607
	* help-fns.el (help-function-arglist): Handle interpreted closures.
608

Stefan Monnier's avatar
Stefan Monnier committed
609
2002-11-20  Miles Bader  <miles@gnu.org>
610

Stefan Monnier's avatar
Stefan Monnier committed
611 612 613 614
	* emacs-lisp/bytecomp.el (byte-compile-stack-adjustment):
	Correctly handle discardN* operators.
	* emacs-lisp/byte-opt.el (byte-optimize-lapcode): Fix stack-depth
	tracking errors.
615

Stefan Monnier's avatar
Stefan Monnier committed
616
2002-08-26  Miles Bader  <miles@gnu.org>
617

Stefan Monnier's avatar
Stefan Monnier committed
618 619
	* international/mule.el (make-char): Macroexpand call to
	charset-id constructed by `byte-compile' hook.
620

Stefan Monnier's avatar
Stefan Monnier committed
621
	* emacs-lisp/macroexp.el (macroexpand-all-1): Expand defconst value.
622

Stefan Monnier's avatar
Stefan Monnier committed
623 624 625 626
	* emacs-lisp/byte-opt.el (byte-opt-update-stack-params): New macro.
	(byte-optimize-lapcode): Keep track of stack-depth in final pass too.
	Add more optimizations for lexical binding.
	(byte-compile-inline-expand): Macroexpand result of inlining.
627

Stefan Monnier's avatar
Stefan Monnier committed
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740
	* emacs-lisp/bytecomp.el (byte-compile-lambda): Update call to
	byte-compile-closure-initial-lexenv-p.
	(byte-discardN-preserve-tos): Alias to byte-discardN.
	(byte-compile-push-binding-init): Don't push unused variables on
	init-lexenv.
	(byte-compile-push-binding-init): Don't use LFORMINFO if it's nil.
	(byte-compile-lambda): Don't look at lexical environment unless
	we're using lexical binding.
	(byte-compile-defmacro): Correctly generate macros.

	* emacs-lisp/byte-lexbind.el (byte-compile-unbind): Optimize the
	dynamic-bindings-only case.
	(byte-compile-bind): Don't special-case unused lexical variables.

	* emacs-lisp/disass.el (disassemble-1): Print arg for discardN ops.

2002-08-19  Miles Bader  <miles@gnu.org>

	* emacs-lisp/byte-opt.el (byte-decompile-bytecode-1):
	Handle `byte-discardN-preserve-tos' pseudo-op.
	(byte-compile-side-effect-and-error-free-ops): Add `byte-stack-ref'.
	(byte-compile-side-effect-free-ops): Add `byte-vec-ref'.
	(byte-optimize-lapcode): Add some cases for stack-set/ref ops.
	Add tracking of stack-depth.  Unfinished code to collapse
	lexical-unbinding sequences.

	* emacs-lisp/bytecomp.el (byte-compile-lapcode):
	Handle `byte-discardN-preserve-tos' pseudo-op.
	(byte-compile-top-level): If there are lexical args, output a TAG
	op to record the initial stack-depth for the optimizer.

2002-08-17  Miles Bader  <miles@gnu.org>

	* emacs-lisp/bytecomp.el (byte-discardN): Add byte-defop.
	(byte-compile-lapcode): Include byte-discardN.
	(byte-compile-lambda): Fixup closure detection.
	(byte-compile-top-level): Handle arguments for a lexical lambda.
	(byte-compile-lexical-variable-ref, byte-compile-variable-ref)
	(byte-compile-variable-set): Use byte-compile-stack-set/ref.
	(byte-compile-discard): Add new parameters NUM and PRESERVE-TOS.
	(byte-compile-stack-ref, byte-compile-stack-set): New functions.
	(byte-compile-push-binding-init): Get the variable list properly
	from LFORMINFO.

	* emacs-lisp/byte-lexbind.el (byte-compile-lforminfo-analyze):
	Ignore setq'd variables we're not interested in.
	(byte-compile-make-lambda-lexenv): Add assertion that closed-over
	variables be heap allocated.
	(byte-compile-closure-initial-lexenv-p): Rename from
	byte-compile-closure-lexenv-p.
	(byte-compile-non-stack-bindings-p): Get the variable list
	properly from LFORMINFO.
	(byte-compile-maybe-push-heap-environment): Handle the
	no-closed-over-variables case correctly.
	(byte-compile-bind): Use byte-compile-stack-set/ref.
	Don't bother modifying INIT-LEXENV as no one will see the changes.
	(byte-compile-unbind): Call `byte-compile-discard' to handle
	unbinding lexical bindings.

	* emacs-lisp/disass.el (disassemble-internal): Handle closures.
	(disassemble-1): Handle new bytecodes.
	* emacs-lisp/byte-opt.el (disassemble-offset): Handle new bytecodes.

2002-06-16  Miles Bader  <miles@gnu.org>

	* emacs-lisp/macroexp.el (macroexp-accumulate): New macro.
	(macroexpand-all-forms, macroexpand-all-clauses): Use it.
	* Makefile.in (compile): Undo previous change.

2002-06-14  Miles Bader  <miles@gnu.org>

	* Makefile.in (COMPILE_FIRST): Add `emacs-lisp/macroexp.el'.
	(compile): Add a special case that compiles `emacs-lisp/macroexp.el'
	with an increased max-lisp-eval-depth.

	* emacs-lisp/bytecomp.el: Provide `bytecomp-preload', at the
	beginning of the file.  Require `byte-lexbind' at compile time.
	Add a few doc string.
	(byte-compile-push-bytecodes)
	(byte-compile-push-bytecode-const2): New macros.
	(byte-compile-lapcode): Use them.  Do general code cleanup.
	(byte-compile-initial-macro-environment): Expand macros in
	byte-compile-eval before passing to byte-compile-top-level.
	(byte-compile): Use the `byte-compile-initial-macro-environment'.

	* emacs-lisp/byte-lexbind.el: Require `bytecomp-preload' instead of
	`bytecomp'.
	(byte-compile-bind): Use `byte-compile-dynamic-variable-bind' to bind
	dynamic variables.
	(byte-compile-maybe-push-heap-environment): Fix function name typo.

2002-06-13  Miles Bader  <miles@gnu.org>

	Byte compiler lexical binding support (not finished yet):
	* emacs-lisp/bytecomp.el: Require `macroexp'.
	(byte-compile-lexical-environment)
	(byte-compile-current-heap-environment)
	(byte-compile-current-num-closures): New variables.
	(0, 178, 179, 180, 181): New byte-opcodes.
	(byte-compile-lapcode): Handle stack-ref/set opcodes.  Signal an
	error if a delay-output placeholder is not filled in yet.
	(byte-compile-file-form, byte-compile): Expand all macros with
	`macroexpand-all'.
	(byte-compile-file-form-defsubst, byte-compile-form): Don't expand
	macros here.
	(byte-compile-make-lambda-lexenv): Autoload.
	(byte-compile-lambda): Initial code for handling lexically-bound
	arguments and closures; doesn't work yet.
	(byte-compile-closure-code-p, byte-compile-make-closure)
	(byte-compile-closure): New functions.
	(byte-compile-check-variable, byte-compile-dynamic-variable-op)
	(byte-compile-dynamic-variable-bind)
	(byte-compile-lexical-variable-ref, byte-compile-variable-set):
741
	New functions.
Stefan Monnier's avatar
Stefan Monnier committed
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789
	(byte-compile-variable-ref): Remove second argument.  Now only
	handles real variable references (not setting or binding).
	(byte-compile-push-unknown-constant)
	(byte-compile-resolve-unknown-constant): New functions.
	(byte-compile-funarg, byte-compile-funarg-2): Functions removed.
	(byte-compile-function-form): Use either `byte-compile-constant'
	or `byte-compile-closure'.
	(byte-compile-setq): Use `byte-compile-variable-set' instead of
	`byte-compile-variable-ref'.
	(apply, mapcar, mapatoms, mapconcat, mapc, sort):
	`byte-defop-compiler-1's removed.
	(byte-compile-while): Make sure lexically-bound variables inside
	the loop don't get stored in an environment outside the loop.
	(byte-compile-compute-lforminfo): Autoload.
	(byte-compile-push-binding-init): New function.
	(byte-compile-let, byte-compile-let*): Handle lexical binding.
	(byte-compile-defun): Use `byte-compile-closure' to do the work.
	(byte-compile-defmacro): Use `byte-compile-make-closure'.
	(byte-compile-defvar): Expand the generated call to `push' since
	we're past macroexpansion already.
	(byte-compile-stack-adjustment): New function.
	(byte-compile-out): Make second arg optional.  Rewrite for clarity.
	(byte-compile-delay-out, byte-compile-delayed-out): New functions.

	* emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
	Don't expand macros here.

	* emacs-lisp/macroexp.el (macroexpand-all-1): Expand defmacro forms.

	* emacs-lisp/byte-lexbind.el (byte-compile-make-lvarinfo)
	(byte-compile-lforminfo-add-var)
	(byte-compile-lforminfo-note-closure)
	(byte-compile-compute-lforminfo)
	(byte-compile-lforminfo-from-lambda)
	(byte-compile-lforminfo-analyze)
	(byte-compile-heapenv-add-accessible-env)
	(byte-compile-heapenv-ensure-access)
	(byte-compile-rearrange-let-clauses, byte-compile-bind)
	(byte-compile-unbind): Fix a bunch of typos.

2002-06-12  Miles Bader  <miles@gnu.org>

	* emacs-lisp/byte-lexbind.el, emacs-lisp/macroexp.el: New files.

	* subr.el (functionp): Function removed (now a subr).
	* help-fns.el (describe-function-1): Handle interpreted closures.

;; arch-tag: bd1b5b8b-fdb2-425d-9ac2-20689fb0ee70