1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 02:31:03 -08:00

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.
This commit is contained in:
Tom Tromey 2018-07-08 09:36:37 -06:00
parent 45eb3b3513
commit e2a78b0d6d
2 changed files with 13 additions and 7 deletions

View file

@ -1195,14 +1195,14 @@
window-width zerop)) window-width zerop))
(side-effect-and-error-free-fns (side-effect-and-error-free-fns
'(arrayp atom '(arrayp atom
bobp bolp bool-vector-p bignump bobp bolp bool-vector-p
buffer-end buffer-list buffer-size buffer-string bufferp buffer-end buffer-list buffer-size buffer-string bufferp
car-safe case-table-p cdr-safe char-or-string-p characterp car-safe case-table-p cdr-safe char-or-string-p characterp
charsetp commandp cons consp charsetp commandp cons consp
current-buffer current-global-map current-indentation current-buffer current-global-map current-indentation
current-local-map current-minor-mode-maps current-time current-local-map current-minor-mode-maps current-time
eobp eolp eq equal eventp eobp eolp eq equal eventp
floatp following-char framep fixnump floatp following-char framep
get-largest-window get-lru-window get-largest-window get-lru-window
hash-table-p hash-table-p
identity ignore integerp integer-or-marker-p interactive-p identity ignore integerp integer-or-marker-p interactive-p

View file

@ -972,11 +972,15 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
NEXT; NEXT;
CASE (Bsub1): 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; NEXT;
CASE (Badd1): 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; NEXT;
CASE (Beqlsign): CASE (Beqlsign):
@ -1027,7 +1031,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
NEXT; NEXT;
CASE (Bnegate): 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; NEXT;
CASE (Bplus): CASE (Bplus):
@ -1324,11 +1330,11 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
NEXT; NEXT;
CASE (Bnumberp): CASE (Bnumberp):
TOP = FIXED_OR_FLOATP (TOP) ? Qt : Qnil; TOP = NUMBERP (TOP) ? Qt : Qnil;
NEXT; NEXT;
CASE (Bintegerp): CASE (Bintegerp):
TOP = FIXNUMP (TOP) ? Qt : Qnil; TOP = INTEGERP (TOP) ? Qt : Qnil;
NEXT; NEXT;
#if BYTE_CODE_SAFE #if BYTE_CODE_SAFE