diff options
| author | Tom Tromey | 2018-07-08 09:36:37 -0600 |
|---|---|---|
| committer | Tom Tromey | 2018-07-12 22:12:28 -0600 |
| commit | e2a78b0d6d844f29acaaddd775c7b1cd6dec7af8 (patch) | |
| tree | d8dcd1bac51c66f828cbd0f980ab1d206626491e | |
| parent | 45eb3b3513619d97d046a8efbe0d16fafc75a734 (diff) | |
| download | emacs-e2a78b0d6d844f29acaaddd775c7b1cd6dec7af8.tar.gz emacs-e2a78b0d6d844f29acaaddd775c7b1cd6dec7af8.zip | |
Bignum fixes for byte-compiler and bytecode interpreter
* lisp/emacs-lisp/byte-opt.el: Mark bignump and fixnump as
side-effect-and-error-free-fns.
* src/bytecode.c (exec_byte_code): Handle bignums.
| -rw-r--r-- | lisp/emacs-lisp/byte-opt.el | 4 | ||||
| -rw-r--r-- | src/bytecode.c | 16 |
2 files changed, 13 insertions, 7 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 5c0b5e340bb..1920503b8c4 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el | |||
| @@ -1195,14 +1195,14 @@ | |||
| 1195 | window-width zerop)) | 1195 | window-width zerop)) |
| 1196 | (side-effect-and-error-free-fns | 1196 | (side-effect-and-error-free-fns |
| 1197 | '(arrayp atom | 1197 | '(arrayp atom |
| 1198 | bobp bolp bool-vector-p | 1198 | bignump bobp bolp bool-vector-p |
| 1199 | buffer-end buffer-list buffer-size buffer-string bufferp | 1199 | buffer-end buffer-list buffer-size buffer-string bufferp |
| 1200 | car-safe case-table-p cdr-safe char-or-string-p characterp | 1200 | car-safe case-table-p cdr-safe char-or-string-p characterp |
| 1201 | charsetp commandp cons consp | 1201 | charsetp commandp cons consp |
| 1202 | current-buffer current-global-map current-indentation | 1202 | current-buffer current-global-map current-indentation |
| 1203 | current-local-map current-minor-mode-maps current-time | 1203 | current-local-map current-minor-mode-maps current-time |
| 1204 | eobp eolp eq equal eventp | 1204 | eobp eolp eq equal eventp |
| 1205 | floatp following-char framep | 1205 | fixnump floatp following-char framep |
| 1206 | get-largest-window get-lru-window | 1206 | get-largest-window get-lru-window |
| 1207 | hash-table-p | 1207 | hash-table-p |
| 1208 | identity ignore integerp integer-or-marker-p interactive-p | 1208 | identity ignore integerp integer-or-marker-p interactive-p |
diff --git a/src/bytecode.c b/src/bytecode.c index 282754d22b6..f87983a59c0 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -972,11 +972,15 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 972 | NEXT; | 972 | NEXT; |
| 973 | 973 | ||
| 974 | CASE (Bsub1): | 974 | CASE (Bsub1): |
| 975 | TOP = FIXNUMP (TOP) ? make_fixnum (XINT (TOP) - 1) : Fsub1 (TOP); | 975 | TOP = (FIXNUMP (TOP) && XINT (TOP) != MOST_NEGATIVE_FIXNUM |
| 976 | ? make_fixnum (XINT (TOP) - 1) | ||
| 977 | : Fsub1 (TOP)); | ||
| 976 | NEXT; | 978 | NEXT; |
| 977 | 979 | ||
| 978 | CASE (Badd1): | 980 | CASE (Badd1): |
| 979 | TOP = FIXNUMP (TOP) ? make_fixnum (XINT (TOP) + 1) : Fadd1 (TOP); | 981 | TOP = (FIXNUMP (TOP) && XINT (TOP) != MOST_POSITIVE_FIXNUM |
| 982 | ? make_fixnum (XINT (TOP) + 1) | ||
| 983 | : Fadd1 (TOP)); | ||
| 980 | NEXT; | 984 | NEXT; |
| 981 | 985 | ||
| 982 | CASE (Beqlsign): | 986 | CASE (Beqlsign): |
| @@ -1027,7 +1031,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1027 | NEXT; | 1031 | NEXT; |
| 1028 | 1032 | ||
| 1029 | CASE (Bnegate): | 1033 | CASE (Bnegate): |
| 1030 | TOP = FIXNUMP (TOP) ? make_fixnum (- XINT (TOP)) : Fminus (1, &TOP); | 1034 | TOP = (FIXNUMP (TOP) && XINT (TOP) != MOST_NEGATIVE_FIXNUM |
| 1035 | ? make_fixnum (- XINT (TOP)) | ||
| 1036 | : Fminus (1, &TOP)); | ||
| 1031 | NEXT; | 1037 | NEXT; |
| 1032 | 1038 | ||
| 1033 | CASE (Bplus): | 1039 | CASE (Bplus): |
| @@ -1324,11 +1330,11 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1324 | NEXT; | 1330 | NEXT; |
| 1325 | 1331 | ||
| 1326 | CASE (Bnumberp): | 1332 | CASE (Bnumberp): |
| 1327 | TOP = FIXED_OR_FLOATP (TOP) ? Qt : Qnil; | 1333 | TOP = NUMBERP (TOP) ? Qt : Qnil; |
| 1328 | NEXT; | 1334 | NEXT; |
| 1329 | 1335 | ||
| 1330 | CASE (Bintegerp): | 1336 | CASE (Bintegerp): |
| 1331 | TOP = FIXNUMP (TOP) ? Qt : Qnil; | 1337 | TOP = INTEGERP (TOP) ? Qt : Qnil; |
| 1332 | NEXT; | 1338 | NEXT; |
| 1333 | 1339 | ||
| 1334 | #if BYTE_CODE_SAFE | 1340 | #if BYTE_CODE_SAFE |