emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] feature/bignum e2a78b0 23/24: Bignum fixes for byte-compil


From: Tom Tromey
Subject: [Emacs-diffs] feature/bignum e2a78b0 23/24: Bignum fixes for byte-compiler and bytecode interpreter
Date: Fri, 13 Jul 2018 00:25:10 -0400 (EDT)

branch: feature/bignum
commit e2a78b0d6d844f29acaaddd775c7b1cd6dec7af8
Author: Tom Tromey <address@hidden>
Commit: Tom Tromey <address@hidden>

    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.
---
 lisp/emacs-lisp/byte-opt.el |  4 ++--
 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 5c0b5e3..1920503 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1195,14 +1195,14 @@
         window-width zerop))
       (side-effect-and-error-free-fns
        '(arrayp atom
-        bobp bolp bool-vector-p
+        bignump bobp bolp bool-vector-p
         buffer-end buffer-list buffer-size buffer-string bufferp
         car-safe case-table-p cdr-safe char-or-string-p characterp
         charsetp commandp cons consp
         current-buffer current-global-map current-indentation
         current-local-map current-minor-mode-maps current-time
         eobp eolp eq equal eventp
-        floatp following-char framep
+        fixnump floatp following-char framep
         get-largest-window get-lru-window
         hash-table-p
         identity ignore integerp integer-or-marker-p interactive-p
diff --git a/src/bytecode.c b/src/bytecode.c
index 282754d..f87983a 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,
          NEXT;
 
        CASE (Bsub1):
-         TOP = FIXNUMP (TOP) ? make_fixnum (XINT (TOP) - 1) : Fsub1 (TOP);
+         TOP = (FIXNUMP (TOP) && XINT (TOP) != MOST_NEGATIVE_FIXNUM
+                ? make_fixnum (XINT (TOP) - 1)
+                : Fsub1 (TOP));
          NEXT;
 
        CASE (Badd1):
-         TOP = FIXNUMP (TOP) ? make_fixnum (XINT (TOP) + 1) : Fadd1 (TOP);
+         TOP = (FIXNUMP (TOP) && XINT (TOP) != MOST_POSITIVE_FIXNUM
+                ? make_fixnum (XINT (TOP) + 1)
+                : Fadd1 (TOP));
          NEXT;
 
        CASE (Beqlsign):
@@ -1027,7 +1031,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, 
Lisp_Object maxdepth,
          NEXT;
 
        CASE (Bnegate):
-         TOP = FIXNUMP (TOP) ? make_fixnum (- XINT (TOP)) : Fminus (1, &TOP);
+         TOP = (FIXNUMP (TOP) && XINT (TOP) != MOST_NEGATIVE_FIXNUM
+                ? make_fixnum (- XINT (TOP))
+                : Fminus (1, &TOP));
          NEXT;
 
        CASE (Bplus):
@@ -1324,11 +1330,11 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object 
vector, Lisp_Object maxdepth,
          NEXT;
 
        CASE (Bnumberp):
-         TOP = FIXED_OR_FLOATP (TOP) ? Qt : Qnil;
+         TOP = NUMBERP (TOP) ? Qt : Qnil;
          NEXT;
 
        CASE (Bintegerp):
-         TOP = FIXNUMP (TOP) ? Qt : Qnil;
+         TOP = INTEGERP (TOP) ? Qt : Qnil;
          NEXT;
 
 #if BYTE_CODE_SAFE



reply via email to

[Prev in Thread] Current Thread [Next in Thread]