[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] feature/gnus-select 0d04cb6 176/218: Fix byte-opt lists of
From: |
Andrew G Cohen |
Subject: |
[Emacs-diffs] feature/gnus-select 0d04cb6 176/218: Fix byte-opt lists of pure functions etc. |
Date: |
Fri, 14 Dec 2018 03:35:37 -0500 (EST) |
branch: feature/gnus-select
commit 0d04cb600669377bee3b91363e27c51276aa6036
Author: Paul Eggert <address@hidden>
Commit: Andrew G Cohen <address@hidden>
Fix byte-opt lists of pure functions etc.
This fixes a bug where a byte-compiler running on 64-bit Emacs
optimized (lsh -1 -1) to #x1fffffffffffffff, an optimization
that is incorrect for .elc files intended for either 32- or
64-bit Emacs. While I was in the neighborhood, I noticed other
glitches in the lists of pure and side-effect-free functions, and
fixed the errors that I found.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns):
Move some functions here from side-effect-and-error-free-fns,
since they can now signal errors. The affected functions are
current-time-string, current-time-zone,
line-beginning-position, line-end-position. Rename langinfo
to locale-info. Add logcount. Remove string-to-int.
(side-effect-and-error-free-fns): Remove minibuffer-window, a
function that can signal errors, and that is already in
side-effect-free-fns.
(pure-fns): Remove ash, lsh, and logb, since they are
platform-dependent and .elc files should be
platform-independent. Add %, logand, logcount. Sort.
Clarify what is meant by “pure”.
---
lisp/emacs-lisp/byte-opt.el | 37 +++++++++++++++++++++++--------------
1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index a316364..55343e1 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1186,6 +1186,7 @@
char-equal char-to-string char-width compare-strings
compare-window-configurations concat coordinates-in-window-p
copy-alist copy-sequence copy-marker cos count-lines
+ current-time-string current-time-zone
decode-char
decode-time default-boundp default-value documentation downcase
elt encode-char exp expt encode-time error-message-string
@@ -1199,8 +1200,9 @@
hash-table-count
int-to-string intern-soft
keymap-parent
- length local-variable-if-set-p local-variable-p log log10 logand
- logb logior lognot logxor lsh langinfo
+ length line-beginning-position line-end-position
+ local-variable-if-set-p local-variable-p locale-info
+ log log10 logand logb logcount logior lognot logxor lsh
make-list make-string make-symbol marker-buffer max member memq min
minibuffer-selected-window minibuffer-window
mod multibyte-char-to-unibyte next-window nth nthcdr number-to-string
@@ -1210,7 +1212,7 @@
radians-to-degrees rassq rassoc read-from-string regexp-quote
region-beginning region-end reverse round
sin sqrt string string< string= string-equal string-lessp
string-to-char
- string-to-int string-to-number substring
+ string-to-number substring
sxhash sxhash-equal sxhash-eq sxhash-eql
symbol-function symbol-name symbol-plist symbol-value
string-make-unibyte
string-make-multibyte string-as-multibyte string-as-unibyte
@@ -1240,7 +1242,6 @@
charsetp commandp cons consp
current-buffer current-global-map current-indentation
current-local-map current-minor-mode-maps current-time
- current-time-string current-time-zone
eobp eolp eq equal eventp
floatp following-char framep
get-largest-window get-lru-window
@@ -1248,9 +1249,9 @@
identity ignore integerp integer-or-marker-p interactive-p
invocation-directory invocation-name
keymapp keywordp
- line-beginning-position line-end-position list listp
+ list listp
make-marker mark mark-marker markerp max-char
- memory-limit minibuffer-window
+ memory-limit
mouse-movement-p
natnump nlistp not null number-or-marker-p numberp
one-window-p overlayp
@@ -1275,16 +1276,24 @@
nil)
-;; pure functions are side-effect free functions whose values depend
-;; only on their arguments. For these functions, calls with constant
-;; arguments can be evaluated at compile time. This may shift run time
-;; errors to compile time.
+;; Pure functions are side-effect free functions whose values depend
+;; only on their arguments, not on the platform. For these functions,
+;; calls with constant arguments can be evaluated at compile time.
+;; This may shift runtime errors to compile time. For example, logand
+;; is pure since its results are machine-independent, whereas ash is
+;; not pure because (ash 1 29)'s value depends on machine word size.
+;;
+;; When deciding whether a function is pure, do not worry about
+;; mutable strings or markers, as they are so unlikely in real code
+;; that they are not worth worrying about. Thus string-to-char is
+;; pure even though it might return different values if a string is
+;; changed, and logand is pure even though it might return different
+;; values if a marker is moved.
(let ((pure-fns
- '(concat symbol-name regexp-opt regexp-quote string-to-syntax
- string-to-char
- ash lsh logb lognot logior logxor
- ceiling floor)))
+ '(% concat logand logcount logior lognot logxor
+ regexp-opt regexp-quote
+ string-to-char string-to-syntax symbol-name)))
(while pure-fns
(put (car pure-fns) 'pure t)
(setq pure-fns (cdr pure-fns)))
- [Emacs-diffs] feature/gnus-select 8671f03 166/218: Adjust eieio persistence tests for expected failure, (continued)
- [Emacs-diffs] feature/gnus-select 8671f03 166/218: Adjust eieio persistence tests for expected failure, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 9d4baa3 165/218: Let eieio-persistent-read read what object-write has written, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select a1b7a1e 163/218: Add new tests for eieio persistence, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 267b827 170/218: Fix commit c24c5dc4a4, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 91bdd5a 157/218: Provide completion in vc-git-stash-* commands, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 8d80db1 154/218: Quieten eieio-test compilation, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 5502f96 161/218: * lisp/ibuf-ext.el (ibuffer-never-search-content-mode): Fix type., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 6dbf88e 171/218: Fix the MSDOS build, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select d5a07be 172/218: * etc/NEWS: Add an entry for auth-source-pass., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select c1d88db 173/218: Document DEFUN attributes, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 0d04cb6 176/218: Fix byte-opt lists of pure functions etc.,
Andrew G Cohen <=
- [Emacs-diffs] feature/gnus-select b36a2f9 178/218: * lisp/org/ob-lisp.el (org-babel-lisp-eval-fn): Tweak type., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 4fdc730 177/218: sql.el defcustom fixes, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select fe87972 186/218: * doc/emacs/trouble.texi: Fix location of `emacs-version' index., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 21aa752 184/218: Make update_autogen work in git worktrees, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 7985c87 188/218: * src/alloc.c: Avoid O(N²) complexity when unchaining markers (bug#24548)., Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 1a1bb0c 185/218: Explain more about (defvar foo) form (Bug#18059), Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select d46646d 195/218: Replace cl in some obsolete files, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select e70347a 202/218: Limit build load, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select f06346b 198/218: Clarify syntax of radixed integers, Andrew G Cohen, 2018/12/14
- [Emacs-diffs] feature/gnus-select 7bb9822 203/218: Remove variables labeled as obsolete that do nothing, Andrew G Cohen, 2018/12/14