1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-26 23:31:55 -08:00
emacs/etc
Stefan Monnier 1b1ffe0789 (Ffunction): Make interpreted closures safe for space
Interpreted closures currently just grab a reference to the complete
lexical environment, so (lambda (x) (+ x y)) can end up looking like

    (closure ((foo ...) (y 7) (bar ...) ...)
             (x) (+ x y))

where the foo/bar/... bindings are not only useless but can prevent
the GC from collecting that memory (i.e. it's a representation that is
not "safe for space") and it can also make that closure "unwritable"
(or more specifically, it can cause the closure's print
representation to be u`read`able).

Compiled closures don't suffer from this problem because `cconv.el`
actually looks at the code and only stores in the compiled closure
those variables which are actually used.

So, we fix this discrepancy by letting the existing code in `cconv.el` tell
`Ffunction` which variables are actually used by the body of the
function such that it can filter out the irrelevant elements and
return a closure of the form:

    (closure ((y 7)) (x) (+ x y))

* lisp/loadup.el: Preload `cconv` and set
`internal-filter-closure-env-function` once we have a usable `cconv-fv`.

* lisp/emacs-lisp/bytecomp.el (byte-compile-preprocess): Adjust to new
calling convention of `cconv-closure-convert`.
(byte-compile-not-lexical-var-p): Delete function, moved to `cconv.el`.
(byte-compile-bind): Use `cconv--not-lexical-var-p`.

* lisp/emacs-lisp/cconv.el (cconv--dynbound-variables): New var.
(cconv-closure-convert): New arg `dynbound-vars`
(cconv--warn-unused-msg): Remove special case for `ignored`,
so we don't get confused when a function uses an argument called
`ignored`, e.g. holding a list of things that it should ignore.
(cconv--not-lexical-var-p): New function, moved from `bytecomp.el`.
Don't special case keywords and `nil` and `t` since they are already
`special-variable-p`.
(cconv--analyze-function): Use `cconv--not-lexical-var-p`.
(cconv--dynbindings): New dynbound var.
(cconv-analyze-form): Use `cconv--not-lexical-var-p`.
Remember in `cconv--dynbindings` the vars for which we used
dynamic scoping.
(cconv-analyze-form): Use `cconv--dynbound-variables` rather than
`byte-compile-bound-variables`.
(cconv-fv): New function.

* src/eval.c (Fsetq, eval_sub): Remove optimization designed when
`lexical-binding == nil` was the common case.
(Ffunction): Use `internal-filter-closure-env-function` when available.
(eval_sub, Ffuncall): Improve error info for `excessive_lisp_nesting`.
(internal-filter-closure-env-function): New defvar.
2022-10-25 14:24:54 -04:00
..
charsets ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
e Implement alternative sub-buffer support in term.el 2022-01-24 20:02:33 +01:00
forms ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
gnus
images ; Prefer HTTPS to HTTP in many URLs 2022-10-15 13:06:45 +02:00
nxml
org ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
refcards Merge from origin/emacs-28 2022-09-05 06:30:32 +02:00
schema ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
srecode ; Prefer HTTPS to HTTP in many URLs 2022-10-15 13:06:45 +02:00
themes Tag themes with properties 2022-10-15 17:22:48 +02:00
tutorials * etc/tutorials/TUTORIAL.uk: Fix typos. 2022-10-05 22:43:12 +03:00
AUTHORS Merge from origin/emacs-28 2022-09-08 23:35:04 +02:00
CALC-NEWS ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
ChangeLog.1 ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
compilation.txt Add test for the gradle-android compilation message pattern 2022-07-11 12:29:12 +02:00
COPYING
DEBUG ; Prefer HTTPS to HTTP in many URLs 2022-10-15 13:06:45 +02:00
DEVEL.HUMOR ; * etc/DEVEL.HUMOR: Add a recent joke. 2022-02-11 10:15:20 +02:00
DISTRIB ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
edt-user.el ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
emacs-buffer.gdb ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
emacs-mail.desktop
emacs.desktop Drop redundant keywords in .desktop files. 2021-08-11 14:05:25 +02:00
emacs.icon
emacs.metainfo.xml ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
emacs.service
emacs_lldb.py LLDB support: handle unsorted enum member lists 2022-08-22 11:18:30 +02:00
emacsclient-mail.desktop Hint that emacsclient.desktop should match a search for “emacsclient” 2021-08-11 14:05:14 +02:00
emacsclient.desktop Drop redundant keywords in .desktop files. 2021-08-11 14:05:25 +02:00
enriched.txt Document 'enriched-toggle-markup' 2022-05-20 15:03:06 +03:00
ERC-NEWS Bury new ERC buffers by default 2022-09-19 17:54:46 -07:00
ETAGS.EBNF ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
ETAGS.README ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
future-bug
gnus-tut.txt ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
grep.txt ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
HELLO Add support for the Coptic script (bug#58330) 2022-10-08 10:46:48 +03:00
HISTORY Update HISTORY for Emacs 28.2 2022-09-12 02:47:11 +02:00
JOKES
MACHINES Merge from origin/emacs-28 2022-01-01 07:03:03 -05:00
MH-E-NEWS ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
NEWS (Ffunction): Make interpreted closures safe for space 2022-10-25 14:24:54 -04:00
NEWS.1-17 (help-fns--first-release): Try and avoid false positives 2022-07-18 22:22:34 -04:00
NEWS.18 (help-fns--first-release): Try and avoid false positives 2022-07-18 22:22:34 -04:00
NEWS.19 (help-fns--first-release): Try and avoid false positives 2022-07-18 22:22:34 -04:00
NEWS.20 (help-fns--first-release): Try and avoid false positives 2022-07-18 22:22:34 -04:00
NEWS.21 ; Prefer HTTPS to HTTP in many URLs 2022-10-15 13:06:45 +02:00
NEWS.22 ; Prefer HTTPS to HTTP in many URLs 2022-10-15 13:06:45 +02:00
NEWS.23 * etc/NEWS.23: Belatedly announce 'format-spec'. 2022-09-27 15:42:30 +02:00
NEWS.24 (help-fns--first-release): Try and avoid false positives 2022-07-18 22:22:34 -04:00
NEWS.25 ; Prefer HTTPS to HTTP in many URLs 2022-10-15 13:06:45 +02:00
NEWS.26 ; Prefer HTTPS to HTTP in many URLs 2022-10-15 13:06:45 +02:00
NEWS.27 (help-fns--first-release): Try and avoid false positives 2022-07-18 22:22:34 -04:00
NEWS.28 Merge from origin/emacs-28 2022-10-01 17:14:47 +02:00
NEXTSTEP ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
NXML-NEWS ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
ORG-NEWS ; Fix typos: prefer American spelling 2022-07-13 13:04:22 +02:00
org.gnu.emacs.defaults.gschema.xml ; Add 2022 to copyright years. 2022-01-01 07:07:15 -05:00
package-keyring.gpg
PROBLEMS * etc/PROBLEMS: Document window manager focus problems. 2022-10-20 19:30:50 +08:00
ps-prin0.ps ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
ps-prin1.ps ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
publicsuffix.txt Update publicsuffix.txt from upstream 2022-10-01 20:17:57 +02:00
README ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
rgb.txt
ses-example.ses ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
spook.lines
TERMS ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
TODO ; Prefer HTTPS to HTTP in many URLs 2022-10-15 13:06:45 +02:00
w32-feature.el ; Add 2022 to copyright years. 2022-01-01 02:45:51 -05:00
yow.lines

This directory contains the architecture-independent files used by or
with Emacs.  This includes some text files of documentation for GNU
Emacs or of interest to Emacs users, and the file of dumped docstrings
for Emacs functions and variables.

COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES

File: emacs.icon
  Author: Sun Microsystems, Inc
  Copyright (C) 1999, 2001-2022 Free Software Foundation, Inc.
  License: GNU General Public License version 3 or later (see COPYING)