diff options
| author | Glenn Morris | 2014-05-11 23:59:30 -0700 |
|---|---|---|
| committer | Glenn Morris | 2014-05-11 23:59:30 -0700 |
| commit | bbbabffe06d4c763534d5be92844c48a3f8746e2 (patch) | |
| tree | a6fffb13638948223f3142e5209cbce57282fbbd /admin | |
| parent | ffd6d9c4d321e93e301f9cafd1fe054389898978 (diff) | |
| parent | 96b894717caa773aa6d98ff57385f1c7537e8972 (diff) | |
| download | emacs-bbbabffe06d4c763534d5be92844c48a3f8746e2.tar.gz emacs-bbbabffe06d4c763534d5be92844c48a3f8746e2.zip | |
Merge from emacs-24; up to 2014-05-12T06:15:47Z!rgm@gnu.org
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/ChangeLog | 8 | ||||
| -rw-r--r-- | admin/admin.el | 23 | ||||
| -rw-r--r-- | admin/find-gc.el | 149 |
3 files changed, 173 insertions, 7 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog index 7af23b779ef..87da4f7e26b 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2014-05-12 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * find-gc.el: Move here from ../lisp/emacs-lisp. | ||
| 4 | |||
| 5 | * admin.el (set-version-in-file): Don't set identical version. | ||
| 6 | (set-version): Provide default version number. | ||
| 7 | (set-version, set-copyright): Give start/end messages. | ||
| 8 | |||
| 1 | 2014-04-18 Paul Eggert <eggert@cs.ucla.edu> | 9 | 2014-04-18 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 10 | ||
| 3 | * notes/bzr: Update instructions for merging from gnulib. | 11 | * notes/bzr: Update instructions for merging from gnulib. |
diff --git a/admin/admin.el b/admin/admin.el index 007cb06e592..7af9ffa4177 100644 --- a/admin/admin.el +++ b/admin/admin.el | |||
| @@ -65,17 +65,25 @@ Optional argument DATE is the release date, default today." | |||
| 65 | "Subroutine of `set-version' and `set-copyright'." | 65 | "Subroutine of `set-version' and `set-copyright'." |
| 66 | (find-file (expand-file-name file root)) | 66 | (find-file (expand-file-name file root)) |
| 67 | (goto-char (point-min)) | 67 | (goto-char (point-min)) |
| 68 | (setq version (format "%s" version)) | ||
| 68 | (unless (re-search-forward rx nil :noerror) | 69 | (unless (re-search-forward rx nil :noerror) |
| 69 | (user-error "Version not found in %s" file)) | 70 | (user-error "Version not found in %s" file)) |
| 70 | (replace-match (format "%s" version) nil nil nil 1)) | 71 | (if (not (equal version (match-string 1))) |
| 72 | (replace-match version nil nil nil 1) | ||
| 73 | (kill-buffer) | ||
| 74 | (message "No need to update `%s'" file))) | ||
| 71 | 75 | ||
| 72 | ;; TODO report the progress | ||
| 73 | (defun set-version (root version) | 76 | (defun set-version (root version) |
| 74 | "Set Emacs version to VERSION in relevant files under ROOT. | 77 | "Set Emacs version to VERSION in relevant files under ROOT. |
| 75 | Root must be the root of an Emacs source tree." | 78 | Root must be the root of an Emacs source tree." |
| 76 | (interactive "DEmacs root directory: \nsVersion number: ") | 79 | (interactive (list |
| 80 | (read-directory-name "Emacs root directory: " source-directory) | ||
| 81 | (read-string "Version number: " | ||
| 82 | (replace-regexp-in-string "\\.[0-9]+\\'" "" | ||
| 83 | emacs-version)))) | ||
| 77 | (unless (file-exists-p (expand-file-name "src/emacs.c" root)) | 84 | (unless (file-exists-p (expand-file-name "src/emacs.c" root)) |
| 78 | (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) | 85 | (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) |
| 86 | (message "Setting version numbers...") | ||
| 79 | ;; There's also a "version 3" (standing for GPLv3) at the end of | 87 | ;; There's also a "version 3" (standing for GPLv3) at the end of |
| 80 | ;; `README', but since `set-version-in-file' only replaces the first | 88 | ;; `README', but since `set-version-in-file' only replaces the first |
| 81 | ;; occurrence, it won't be replaced. | 89 | ;; occurrence, it won't be replaced. |
| @@ -158,11 +166,10 @@ Root must be the root of an Emacs source tree." | |||
| 158 | {\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs") | 166 | {\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs") |
| 159 | (set-version-in-file root "etc/refcards/emacsver.tex" version | 167 | (set-version-in-file root "etc/refcards/emacsver.tex" version |
| 160 | "\\\\def\\\\versionemacs\ | 168 | "\\\\def\\\\versionemacs\ |
| 161 | {\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs")))) | 169 | {\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs"))) |
| 162 | 170 | (message "Setting version numbers...done")) | |
| 163 | 171 | ||
| 164 | ;; Note this makes some assumptions about form of short copyright. | 172 | ;; Note this makes some assumptions about form of short copyright. |
| 165 | ;; TODO report the progress | ||
| 166 | (defun set-copyright (root copyright) | 173 | (defun set-copyright (root copyright) |
| 167 | "Set Emacs short copyright to COPYRIGHT in relevant files under ROOT. | 174 | "Set Emacs short copyright to COPYRIGHT in relevant files under ROOT. |
| 168 | Root must be the root of an Emacs source tree." | 175 | Root must be the root of an Emacs source tree." |
| @@ -174,6 +181,7 @@ Root must be the root of an Emacs source tree." | |||
| 174 | (format-time-string "%Y"))))) | 181 | (format-time-string "%Y"))))) |
| 175 | (unless (file-exists-p (expand-file-name "src/emacs.c" root)) | 182 | (unless (file-exists-p (expand-file-name "src/emacs.c" root)) |
| 176 | (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) | 183 | (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) |
| 184 | (message "Setting copyrights...") | ||
| 177 | (set-version-in-file root "configure.ac" copyright | 185 | (set-version-in-file root "configure.ac" copyright |
| 178 | (rx (and bol "copyright" (0+ (not (in ?\"))) | 186 | (rx (and bol "copyright" (0+ (not (in ?\"))) |
| 179 | ?\" (submatch (1+ (not (in ?\")))) ?\"))) | 187 | ?\" (submatch (1+ (not (in ?\")))) ?\"))) |
| @@ -195,7 +203,8 @@ Root must be the root of an Emacs source tree." | |||
| 195 | {\\([0-9]\\{4\\}\\)}.+%.+copyright year") | 203 | {\\([0-9]\\{4\\}\\)}.+%.+copyright year") |
| 196 | (set-version-in-file root "etc/refcards/emacsver.tex" copyright | 204 | (set-version-in-file root "etc/refcards/emacsver.tex" copyright |
| 197 | "\\\\def\\\\year\ | 205 | "\\\\def\\\\year\ |
| 198 | {\\([0-9]\\{4\\}\\)}.+%.+copyright year"))) | 206 | {\\([0-9]\\{4\\}\\)}.+%.+copyright year")) |
| 207 | (message "Setting copyrights...done")) | ||
| 199 | 208 | ||
| 200 | ;;; Various bits of magic for generating the web manuals | 209 | ;;; Various bits of magic for generating the web manuals |
| 201 | 210 | ||
diff --git a/admin/find-gc.el b/admin/find-gc.el new file mode 100644 index 00000000000..83eb26e86d7 --- /dev/null +++ b/admin/find-gc.el | |||
| @@ -0,0 +1,149 @@ | |||
| 1 | ;;; find-gc.el --- detect functions that call the garbage collector | ||
| 2 | |||
| 3 | ;; Copyright (C) 1992, 2001-2014 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Maintainer: emacs-devel@gnu.org | ||
| 6 | |||
| 7 | ;; This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 10 | ;; it under the terms of the GNU General Public License as published by | ||
| 11 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 12 | ;; (at your option) any later version. | ||
| 13 | |||
| 14 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ;; GNU General Public License for more details. | ||
| 18 | |||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Commentary: | ||
| 23 | |||
| 24 | ;; Produce in find-gc-unsafe-list the set of all functions that may invoke GC. | ||
| 25 | ;; This expects the Emacs sources to live in find-gc-source-directory. | ||
| 26 | |||
| 27 | ;;; Code: | ||
| 28 | |||
| 29 | (defvar find-gc-unsafe-list nil | ||
| 30 | "The list of unsafe functions is placed here by `find-gc-unsafe'.") | ||
| 31 | |||
| 32 | (defvar find-gc-source-directory | ||
| 33 | (file-name-as-directory (expand-file-name "src" source-directory)) | ||
| 34 | "Directory containing Emacs C sources.") | ||
| 35 | |||
| 36 | (defvar find-gc-subrs-callers nil | ||
| 37 | "Alist of users of subrs, from GC testing. | ||
| 38 | Each entry has the form (FUNCTION . FUNCTIONS-THAT-CALL-IT).") | ||
| 39 | |||
| 40 | (defvar find-gc-subrs-called nil | ||
| 41 | "Alist of subrs called, in GC testing. | ||
| 42 | Each entry has the form (FUNCTION . FUNCTIONS-IT-CALLS).") | ||
| 43 | |||
| 44 | |||
| 45 | ;;; Functions on this list are safe, even if they appear to be able | ||
| 46 | ;;; to call the target. | ||
| 47 | |||
| 48 | (defvar find-gc-noreturn-list '(Fsignal Fthrow wrong_type_argument)) | ||
| 49 | |||
| 50 | ;;; This was originally generated directory-files, but there were | ||
| 51 | ;;; too many files there that were not actually compiled. The | ||
| 52 | ;;; list below was created for a HP-UX 7.0 system. | ||
| 53 | |||
| 54 | (defvar find-gc-source-files | ||
| 55 | '("dispnew.c" "scroll.c" "xdisp.c" "window.c" | ||
| 56 | "term.c" "cm.c" "emacs.c" "keyboard.c" "macros.c" | ||
| 57 | "keymap.c" "sysdep.c" "buffer.c" "filelock.c" | ||
| 58 | "insdel.c" "marker.c" "minibuf.c" "fileio.c" | ||
| 59 | "dired.c" "cmds.c" "casefiddle.c" | ||
| 60 | "indent.c" "search.c" "regex.c" "undo.c" | ||
| 61 | "alloc.c" "data.c" "doc.c" "editfns.c" | ||
| 62 | "callint.c" "eval.c" "fns.c" "print.c" "lread.c" | ||
| 63 | "syntax.c" "unexcoff.c" | ||
| 64 | "bytecode.c" "process.c" "callproc.c" "doprnt.c" | ||
| 65 | "xterm.c" "xfns.c")) | ||
| 66 | |||
| 67 | |||
| 68 | (defun find-gc-unsafe () | ||
| 69 | "Return a list of unsafe functions--that is, which can call GC. | ||
| 70 | Also store it in `find-gc-unsafe-list'." | ||
| 71 | (trace-call-tree nil) | ||
| 72 | (trace-use-tree) | ||
| 73 | (find-unsafe-funcs 'Fgarbage_collect) | ||
| 74 | (setq find-gc-unsafe-list | ||
| 75 | (sort find-gc-unsafe-list | ||
| 76 | (function (lambda (x y) | ||
| 77 | (string-lessp (car x) (car y))))))) | ||
| 78 | |||
| 79 | ;;; This does a depth-first search to find all functions that can | ||
| 80 | ;;; ultimately call the function "target". The result is an a-list | ||
| 81 | ;;; in find-gc-unsafe-list; the cars are the unsafe functions, and the cdrs | ||
| 82 | ;;; are (one of) the unsafe functions that these functions directly | ||
| 83 | ;;; call. | ||
| 84 | |||
| 85 | (defun find-unsafe-funcs (target) | ||
| 86 | (setq find-gc-unsafe-list (list (list target))) | ||
| 87 | (trace-unsafe target)) | ||
| 88 | |||
| 89 | (defun trace-unsafe (func) | ||
| 90 | (let ((used (assq func find-gc-subrs-callers))) | ||
| 91 | (or used | ||
| 92 | (error "No find-gc-subrs-callers for %s" (car find-gc-unsafe-list))) | ||
| 93 | (while (setq used (cdr used)) | ||
| 94 | (or (assq (car used) find-gc-unsafe-list) | ||
| 95 | (memq (car used) find-gc-noreturn-list) | ||
| 96 | (progn | ||
| 97 | (push (cons (car used) func) find-gc-unsafe-list) | ||
| 98 | (trace-unsafe (car used))))))) | ||
| 99 | |||
| 100 | |||
| 101 | |||
| 102 | |||
| 103 | (defun trace-call-tree (&optional ignored) | ||
| 104 | (message "Setting up directories...") | ||
| 105 | (setq find-gc-subrs-called nil) | ||
| 106 | (let ((case-fold-search nil) | ||
| 107 | (default-directory find-gc-source-directory) | ||
| 108 | (files find-gc-source-files) | ||
| 109 | name entry rtlfile) | ||
| 110 | (dolist (file files) | ||
| 111 | (message "Compiling %s..." file) | ||
| 112 | (call-process "gcc" nil nil nil "-I" "." "-I" "../lib" | ||
| 113 | "-fdump-rtl-expand" "-o" null-device "-c" file) | ||
| 114 | (setq rtlfile | ||
| 115 | (file-expand-wildcards (format "%s.*.expand" file) t)) | ||
| 116 | (if (/= 1 (length rtlfile)) | ||
| 117 | (message "Error compiling `%s'?" file) | ||
| 118 | (with-temp-buffer | ||
| 119 | (insert-file-contents (setq rtlfile (car rtlfile))) | ||
| 120 | (delete-file rtlfile) | ||
| 121 | (while (re-search-forward ";; Function \\|(call_insn " nil t) | ||
| 122 | (if (= (char-after (- (point) 3)) ?o) | ||
| 123 | (progn | ||
| 124 | (looking-at "[a-zA-Z0-9_]+") | ||
| 125 | (setq name (intern (match-string 0))) | ||
| 126 | (message "%s : %s" (car files) name) | ||
| 127 | (setq entry (list name) | ||
| 128 | find-gc-subrs-called | ||
| 129 | (cons entry find-gc-subrs-called))) | ||
| 130 | (if (looking-at ".*\n?.*\"\\([A-Za-z0-9_]+\\)\"") | ||
| 131 | (progn | ||
| 132 | (setq name (intern (match-string 1))) | ||
| 133 | (or (memq name (cdr entry)) | ||
| 134 | (setcdr entry (cons name (cdr entry))))))))))))) | ||
| 135 | |||
| 136 | (defun trace-use-tree () | ||
| 137 | (setq find-gc-subrs-callers (mapcar 'list (mapcar 'car find-gc-subrs-called))) | ||
| 138 | (let ((ptr find-gc-subrs-called) | ||
| 139 | p2 found) | ||
| 140 | (while ptr | ||
| 141 | (setq p2 (car ptr)) | ||
| 142 | (while (setq p2 (cdr p2)) | ||
| 143 | (if (setq found (assq (car p2) find-gc-subrs-callers)) | ||
| 144 | (setcdr found (cons (car (car ptr)) (cdr found))))) | ||
| 145 | (setq ptr (cdr ptr))))) | ||
| 146 | |||
| 147 | (provide 'find-gc) | ||
| 148 | |||
| 149 | ;;; find-gc.el ends here | ||