commit 0515b223c2158984e135e84be97c01d5b8d0ae75 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Tue Jan 1 15:13:22 2019 -0800 Don’t limit range error reports to fixnums * src/lisp.h (CHECK_RANGED_INTEGER): When signaling an error, don’t arbitrarily limit the reported valid range to fixnums. diff --git a/src/lisp.h b/src/lisp.h index 14a61d3f10..dce61c165c 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2841,12 +2841,7 @@ CHECK_FIXNAT (Lisp_Object x) do { \ CHECK_FIXNUM (x); \ if (! ((lo) <= XFIXNUM (x) && XFIXNUM (x) <= (hi))) \ - args_out_of_range_3 \ - (x, \ - make_fixnum ((lo) < 0 && (lo) < MOST_NEGATIVE_FIXNUM \ - ? MOST_NEGATIVE_FIXNUM \ - : (lo)), \ - make_fixnum (min (hi, MOST_POSITIVE_FIXNUM))); \ + args_out_of_range_3 (x, INT_TO_INTEGER (lo), INT_TO_INTEGER (hi)); \ } while (false) #define CHECK_TYPE_RANGED_INTEGER(type, x) \ do { \ commit 8b5f05e93871a6a6f853b3f0807eb0a3660f5f5e Author: Paul Eggert Date: Tue Jan 1 15:06:50 2019 -0800 Bignums from garbage-collect, memory-use-counts Do not limit the results of garbage-collect and memory-use-counts to fixnums, as they might be bignums now on 32-bit hosts. * src/lisp.h (byte_ct): New type. * src/alloc.c (object_ct): New type. (consing_since_gc, gc_relative_threshold) (memory_full_cons_threshold, total_string_bytes): Now byte_ct, not EMACS_INT. (total_conses, total_symbols, total_buffers, total_free_conses) (total_free_symbols, total_free_floats, total_floats) (total_free_intervals, total_intervals, total_strings) (total_free_strings, total_vectors, total_vector_slots) (total_free_vector_slots): Now object_ct, not EMACS_INT. (bounded_number): Remove. All uses removed. (object_bytes): New function. (total_bytes_of_live_objects, garbage_collect_1): Use byte_ct, not size_t, to count total GC bytes where multiple objects are involved. (garbage_collect_1, Fmemory_use_counts): Do not limit returned counts to fixnums. (sweep_conses, sweep_floats, sweep_intervals, sweep_symbols): Use object_ct, not EMACS_INT, to count GC objects. diff --git a/src/alloc.c b/src/alloc.c index 70e417e9f8..407ac72541 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -231,26 +231,31 @@ struct emacs_globals globals; /* Number of bytes of consing done since the last gc. */ -EMACS_INT consing_since_gc; +byte_ct consing_since_gc; /* Similar minimum, computed from Vgc_cons_percentage. */ -EMACS_INT gc_relative_threshold; +byte_ct gc_relative_threshold; /* Minimum number of bytes of consing since GC before next GC, when memory is full. */ -EMACS_INT memory_full_cons_threshold; +byte_ct memory_full_cons_threshold; /* True during GC. */ bool gc_in_progress; +/* Type of object counts reported by GC. Unlike byte_ct, this can be + signed, e.g., it is less than 2**31 on a typical 32-bit machine. */ + +typedef intptr_t object_ct; + /* Number of live and free conses etc. */ -static EMACS_INT total_conses, total_symbols, total_buffers; -static EMACS_INT total_free_conses, total_free_symbols; -static EMACS_INT total_free_floats, total_floats; +static object_ct total_conses, total_symbols, total_buffers; +static object_ct total_free_conses, total_free_symbols; +static object_ct total_free_floats, total_floats; /* Points to memory space allocated as "spare", to be freed if we run out of memory. We keep one large block, four cons-blocks, and @@ -1515,7 +1520,7 @@ static int interval_block_index = INTERVAL_BLOCK_SIZE; /* Number of free and live intervals. */ -static EMACS_INT total_free_intervals, total_intervals; +static object_ct total_free_intervals, total_intervals; /* List of free intervals. */ @@ -1731,11 +1736,11 @@ static struct Lisp_String *string_free_list; /* Number of live and free Lisp_Strings. */ -static EMACS_INT total_strings, total_free_strings; +static object_ct total_strings, total_free_strings; /* Number of bytes used by live strings. */ -static EMACS_INT total_string_bytes; +static byte_ct total_string_bytes; /* Given a pointer to a Lisp_String S which is on the free-list string_free_list, return a pointer to its successor in the @@ -3039,11 +3044,11 @@ Lisp_Object zero_vector; /* Number of live vectors. */ -static EMACS_INT total_vectors; +static object_ct total_vectors; /* Total size of live and free vectors, in Lisp_Object units. */ -static EMACS_INT total_vector_slots, total_free_vector_slots; +static object_ct total_vector_slots, total_free_vector_slots; /* Common shortcut to setup vector on a free list. */ @@ -5556,28 +5561,29 @@ inhibit_garbage_collection (void) return count; } -/* Used to avoid possible overflows when - converting from C to Lisp integers. */ +/* Return the number of bytes in N objects each of size S, guarding + against overflow if size_t is narrower than byte_ct. */ -static Lisp_Object -bounded_number (EMACS_INT number) +static byte_ct +object_bytes (object_ct n, size_t s) { - return make_fixnum (min (MOST_POSITIVE_FIXNUM, number)); + byte_ct b = s; + return n * b; } /* Calculate total bytes of live objects. */ -static size_t +static byte_ct total_bytes_of_live_objects (void) { - size_t tot = 0; - tot += total_conses * sizeof (struct Lisp_Cons); - tot += total_symbols * sizeof (struct Lisp_Symbol); + byte_ct tot = 0; + tot += object_bytes (total_conses, sizeof (struct Lisp_Cons)); + tot += object_bytes (total_symbols, sizeof (struct Lisp_Symbol)); tot += total_string_bytes; - tot += total_vector_slots * word_size; - tot += total_floats * sizeof (struct Lisp_Float); - tot += total_intervals * sizeof (struct interval); - tot += total_strings * sizeof (struct Lisp_String); + tot += object_bytes (total_vector_slots, word_size); + tot += object_bytes (total_floats, sizeof (struct Lisp_Float)); + tot += object_bytes (total_intervals, sizeof (struct interval)); + tot += object_bytes (total_strings, sizeof (struct Lisp_String)); return tot; } @@ -5743,7 +5749,7 @@ garbage_collect_1 (void *end) ptrdiff_t count = SPECPDL_INDEX (); struct timespec start; Lisp_Object retval = Qnil; - size_t tot_before = 0; + byte_ct tot_before = 0; /* Can't GC if pure storage overflowed because we can't determine if something is a pure object or not. */ @@ -5898,10 +5904,10 @@ garbage_collect_1 (void *end) tot *= XFLOAT_DATA (Vgc_cons_percentage); if (0 < tot) { - if (tot < TYPE_MAXIMUM (EMACS_INT)) + if (tot < UINTPTR_MAX) gc_relative_threshold = tot; else - gc_relative_threshold = TYPE_MAXIMUM (EMACS_INT); + gc_relative_threshold = UINTPTR_MAX; } } @@ -5917,35 +5923,35 @@ garbage_collect_1 (void *end) Lisp_Object total[] = { list4 (Qconses, make_fixnum (sizeof (struct Lisp_Cons)), - bounded_number (total_conses), - bounded_number (total_free_conses)), + make_int (total_conses), + make_int (total_free_conses)), list4 (Qsymbols, make_fixnum (sizeof (struct Lisp_Symbol)), - bounded_number (total_symbols), - bounded_number (total_free_symbols)), + make_int (total_symbols), + make_int (total_free_symbols)), list4 (Qstrings, make_fixnum (sizeof (struct Lisp_String)), - bounded_number (total_strings), - bounded_number (total_free_strings)), + make_int (total_strings), + make_int (total_free_strings)), list3 (Qstring_bytes, make_fixnum (1), - bounded_number (total_string_bytes)), + make_int (total_string_bytes)), list3 (Qvectors, make_fixnum (header_size + sizeof (Lisp_Object)), - bounded_number (total_vectors)), + make_int (total_vectors)), list4 (Qvector_slots, make_fixnum (word_size), - bounded_number (total_vector_slots), - bounded_number (total_free_vector_slots)), + make_int (total_vector_slots), + make_int (total_free_vector_slots)), list4 (Qfloats, make_fixnum (sizeof (struct Lisp_Float)), - bounded_number (total_floats), - bounded_number (total_free_floats)), + make_int (total_floats), + make_int (total_free_floats)), list4 (Qintervals, make_fixnum (sizeof (struct interval)), - bounded_number (total_intervals), - bounded_number (total_free_intervals)), + make_int (total_intervals), + make_int (total_free_intervals)), list3 (Qbuffers, make_fixnum (sizeof (struct buffer)), - bounded_number (total_buffers)), + make_int (total_buffers)), #ifdef DOUG_LEA_MALLOC list4 (Qheap, make_fixnum (1024), - bounded_number ((mallinfo ().uordblks + 1023) >> 10), - bounded_number ((mallinfo ().fordblks + 1023) >> 10)), + make_int ((mallinfo ().uordblks + 1023) >> 10), + make_int ((mallinfo ().fordblks + 1023) >> 10)), #endif }; retval = CALLMANY (Flist, total); @@ -5973,11 +5979,9 @@ garbage_collect_1 (void *end) /* Collect profiling data. */ if (profiler_memory_running) { - size_t swept = 0; - size_t tot_after = total_bytes_of_live_objects (); - if (tot_before > tot_after) - swept = tot_before - tot_after; - malloc_probe (swept); + byte_ct tot_after = total_bytes_of_live_objects (); + byte_ct swept = tot_before <= tot_after ? 0 : tot_before - tot_after; + malloc_probe (min (swept, SIZE_MAX)); } return retval; @@ -6584,14 +6588,13 @@ NO_INLINE /* For better stack traces */ static void sweep_conses (void) { - struct cons_block *cblk; struct cons_block **cprev = &cons_block; int lim = cons_block_index; - EMACS_INT num_free = 0, num_used = 0; + object_ct num_free = 0, num_used = 0; cons_free_list = 0; - for (cblk = cons_block; cblk; cblk = *cprev) + for (struct cons_block *cblk; (cblk = *cprev); ) { int i = 0; int this_free = 0; @@ -6663,18 +6666,16 @@ NO_INLINE /* For better stack traces */ static void sweep_floats (void) { - register struct float_block *fblk; struct float_block **fprev = &float_block; - register int lim = float_block_index; - EMACS_INT num_free = 0, num_used = 0; + int lim = float_block_index; + object_ct num_free = 0, num_used = 0; float_free_list = 0; - for (fblk = float_block; fblk; fblk = *fprev) + for (struct float_block *fblk; (fblk = *fprev); ) { - register int i; int this_free = 0; - for (i = 0; i < lim; i++) + for (int i = 0; i < lim; i++) { struct Lisp_Float *afloat = ptr_bounds_copy (&fblk->floats[i], fblk); if (!FLOAT_MARKED_P (afloat)) @@ -6714,19 +6715,17 @@ NO_INLINE /* For better stack traces */ static void sweep_intervals (void) { - register struct interval_block *iblk; struct interval_block **iprev = &interval_block; - register int lim = interval_block_index; - EMACS_INT num_free = 0, num_used = 0; + int lim = interval_block_index; + object_ct num_free = 0, num_used = 0; interval_free_list = 0; - for (iblk = interval_block; iblk; iblk = *iprev) + for (struct interval_block *iblk; (iblk = *iprev); ) { - register int i; int this_free = 0; - for (i = 0; i < lim; i++) + for (int i = 0; i < lim; i++) { if (!iblk->intervals[i].gcmarkbit) { @@ -6768,7 +6767,7 @@ sweep_symbols (void) struct symbol_block *sblk; struct symbol_block **sprev = &symbol_block; int lim = symbol_block_index; - EMACS_INT num_free = 0, num_used = ARRAYELTS (lispsym); + object_ct num_free = 0, num_used = ARRAYELTS (lispsym); symbol_free_list = NULL; @@ -6955,13 +6954,13 @@ Frames, windows, buffers, and subprocesses count as vectors (void) { return listn (CONSTYPE_HEAP, 7, - bounded_number (cons_cells_consed), - bounded_number (floats_consed), - bounded_number (vector_cells_consed), - bounded_number (symbols_consed), - bounded_number (string_chars_consed), - bounded_number (intervals_consed), - bounded_number (strings_consed)); + make_int (cons_cells_consed), + make_int (floats_consed), + make_int (vector_cells_consed), + make_int (symbols_consed), + make_int (string_chars_consed), + make_int (intervals_consed), + make_int (strings_consed)); } static bool diff --git a/src/lisp.h b/src/lisp.h index b650702bdd..14a61d3f10 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3592,9 +3592,10 @@ extern void mark_stack (char *, char *); extern void flush_stack_call_func (void (*func) (void *arg), void *arg); extern const char *pending_malloc_warning; extern Lisp_Object zero_vector; -extern EMACS_INT consing_since_gc; -extern EMACS_INT gc_relative_threshold; -extern EMACS_INT memory_full_cons_threshold; +typedef uintptr_t byte_ct; /* System byte counts reported by GC. */ +extern byte_ct consing_since_gc; +extern byte_ct gc_relative_threshold; +extern byte_ct memory_full_cons_threshold; extern Lisp_Object list1 (Lisp_Object); extern Lisp_Object list2 (Lisp_Object, Lisp_Object); extern Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object); commit ba1b340988ab79a1173f402f8f66bff06e0dd7c5 Author: Paul Eggert Date: Tue Jan 1 11:41:16 2019 -0800 Be consistent about list length fixnum overflow * src/fns.c (Flength, Fproper_list_p): Use overflow_error to report the (typically impossible) fixnum overflow. diff --git a/src/fns.c b/src/fns.c index e40eb2e54a..7791310a31 100644 --- a/src/fns.c +++ b/src/fns.c @@ -118,7 +118,7 @@ To get the number of bytes, use `string-bytes'. */) i++; CHECK_LIST_END (sequence, sequence); if (MOST_POSITIVE_FIXNUM < i) - error ("List too long"); + overflow_error (); val = make_fixnum (i); } else if (NILP (sequence)) @@ -161,7 +161,7 @@ A proper list is neither circular nor dotted (i.e., its last cdr is nil). */ if (!NILP (last_tail)) return Qnil; if (MOST_POSITIVE_FIXNUM < len) - xsignal0 (Qoverflow_error); + overflow_error (); return make_fixnum (len); } commit 504457673dabfa89cb2eac89f093f10736c52ca7 Author: Paul Eggert Date: Tue Jan 1 11:35:17 2019 -0800 Fix woman.el to not confuse scan-sexps * lisp/woman.el (woman-unpadded-space-char): Escape the close-bracket (Bug#33940). diff --git a/lisp/woman.el b/lisp/woman.el index 13aea5d91c..9548fdc6b3 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -2078,7 +2078,7 @@ alist in `woman-buffer-alist' and return nil." (char-to-string woman-escaped-escape-char) "Internal string representation of escaped escape characters.") -(defconst woman-unpadded-space-char ?\^] +(defconst woman-unpadded-space-char ?\^\] ;; An arbitrary unused control character "Internal character representation of unpadded space characters.") (defconst woman-unpadded-space-string commit 227343947f083e1094ebd3770f774b480beb2590 Author: Paul Eggert Date: Tue Jan 1 11:33:10 2019 -0800 decode-time: allow bignum years * src/timefns.c (TM_YEAR_BASE): Now a constant as it need not be a macro. (Fdecode_time): Do not signal an overflow merely because the Gregorian year number does not fix in a fixnum (which can happen on hosts with 64-bit time_t and with 32-bit int and EMACS_INT). diff --git a/src/timefns.c b/src/timefns.c index 437b5b2213..4c99fe5806 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -44,7 +44,7 @@ along with GNU Emacs. If not, see . */ # define HAVE_TZALLOC_BUG false #endif -#define TM_YEAR_BASE 1900 +enum { TM_YEAR_BASE = 1900 }; #ifndef HAVE_TM_GMTOFF # define HAVE_TM_GMTOFF false @@ -1336,12 +1336,22 @@ usage: (decode-time &optional TIME ZONE) */) if (!tm) time_error (localtime_errno); - if (! (MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= local_tm.tm_year - && local_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE)) - time_overflow (); - /* Avoid overflow when INT_MAX < EMACS_INT_MAX. */ - EMACS_INT tm_year_base = TM_YEAR_BASE; + Lisp_Object year; + if (FASTER_TIMEFNS + && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= local_tm.tm_year + && local_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE) + { + /* Avoid overflow when INT_MAX - TM_YEAR_BASE < local_tm.tm_year. */ + EMACS_INT tm_year_base = TM_YEAR_BASE; + year = make_fixnum (local_tm.tm_year + tm_year_base); + } + else + { + mpz_set_si (mpz[0], local_tm.tm_year); + mpz_add_ui (mpz[0], mpz[0], TM_YEAR_BASE); + year = make_integer_mpz (); + } return CALLN (Flist, make_fixnum (local_tm.tm_sec), @@ -1349,7 +1359,7 @@ usage: (decode-time &optional TIME ZONE) */) make_fixnum (local_tm.tm_hour), make_fixnum (local_tm.tm_mday), make_fixnum (local_tm.tm_mon + 1), - make_fixnum (local_tm.tm_year + tm_year_base), + year, make_fixnum (local_tm.tm_wday), (local_tm.tm_isdst < 0 ? make_fixnum (-1) : local_tm.tm_isdst == 0 ? Qnil : Qt), @@ -1360,7 +1370,7 @@ usage: (decode-time &optional TIME ZONE) */) : Qnil)); } -/* Return OBJ - OFFSET, checking that OBJ is a valid fixnum and that +/* Return OBJ - OFFSET, checking that OBJ is a valid integer and that the result is representable as an int. 0 <= OFFSET <= TM_YEAR_BASE. */ static int check_tm_member (Lisp_Object obj, int offset) commit 355b1c3cb91a226d1f58098944542142eddccb60 Author: Glenn Morris Date: Tue Jan 1 07:24:58 2019 -0500 ; Auto-commit of loaddefs files. diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index f90815dc9b..f2e1f88a6a 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -6112,7 +6112,10 @@ if ARG is `toggle'; disable the mode otherwise. ;;;;;; (0 0 0 0)) ;;; Generated autoloads from emacs-lisp/cursor-sensor.el -(defvar cursor-sensor-inhibit nil) +(defvar cursor-sensor-inhibit nil "\ +When non-nil, suspend `cursor-sensor-mode' and `cursor-intangible-mode'. +By convention, this is a list of symbols where each symbol stands for the +\"cause\" of the suspension.") (autoload 'cursor-intangible-mode "cursor-sensor" "\ Keep cursor outside of any `cursor-intangible' text property. @@ -13089,7 +13092,7 @@ to get the effect of a C-q. ;;;### (autoloads nil "flymake" "progmodes/flymake.el" (0 0 0 0)) ;;; Generated autoloads from progmodes/flymake.el -(push (purecopy '(flymake 1 0)) package--builtin-versions) +(push (purecopy '(flymake 1 0 3)) package--builtin-versions) (autoload 'flymake-log "flymake" "\ Log, at level LEVEL, the message MSG formatted with ARGS. @@ -13106,7 +13109,12 @@ TYPE is a key to symbol and TEXT is a description of the problem detected in this region. DATA is any object that the caller wishes to attach to the created diagnostic for later retrieval. -\(fn BUFFER BEG END TYPE TEXT &optional DATA)" nil nil) +OVERLAY-PROPERTIES is an an alist of properties attached to the +created diagnostic, overriding the default properties and any +properties of `flymake-overlay-control' of the diagnostic's +type. + +\(fn BUFFER BEG END TYPE TEXT &optional DATA OVERLAY-PROPERTIES)" nil nil) (autoload 'flymake-diagnostics "flymake" "\ Get Flymake diagnostics in region determined by BEG and END. @@ -19260,7 +19268,7 @@ locally, like so: ;;;### (autoloads nil "jsonrpc" "jsonrpc.el" (0 0 0 0)) ;;; Generated autoloads from jsonrpc.el -(push (purecopy '(jsonrpc 1 0 6)) package--builtin-versions) +(push (purecopy '(jsonrpc 1 0 7)) package--builtin-versions) (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "jsonrpc" '("jrpc-default-request-timeout" "jsonrpc-"))) @@ -20658,7 +20666,7 @@ Default bookmark handler for Man buffers. ;;; Generated autoloads from emacs-lisp/map.el (push (purecopy '(map 1 2)) package--builtin-versions) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "map" '("map"))) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "map" '("map-"))) ;;;*** @@ -30271,7 +30279,7 @@ Like `mail' command, but display mail buffer in another frame. ;;;### (autoloads nil "seq" "emacs-lisp/seq.el" (0 0 0 0)) ;;; Generated autoloads from emacs-lisp/seq.el -(push (purecopy '(seq 2 20)) package--builtin-versions) +(push (purecopy '(seq 2 21)) package--builtin-versions) (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "seq" '("seq-"))) @@ -34747,7 +34755,7 @@ the output buffer or changing the window configuration. ;;;### (autoloads nil "tramp" "net/tramp.el" (0 0 0 0)) ;;; Generated autoloads from net/tramp.el -(push (purecopy '(tramp 2 4 1 -1)) package--builtin-versions) +(push (purecopy '(tramp 2 4 1)) package--builtin-versions) (defvar tramp-mode t "\ Whether Tramp is enabled. @@ -34861,11 +34869,6 @@ Add archive file name handler to `file-name-handler-alist'." (when tramp-archive ;;;### (autoloads nil "tramp-ftp" "net/tramp-ftp.el" (0 0 0 0)) ;;; Generated autoloads from net/tramp-ftp.el -(autoload 'tramp-ftp-enable-ange-ftp "tramp-ftp" "\ -Reenable Ange-FTP, when Tramp is unloaded. - -\(fn)" nil nil) - (if (fboundp 'register-definition-prefixes) (register-definition-prefixes "tramp-ftp" '("tramp-"))) ;;;*** @@ -34899,6 +34902,14 @@ Reenable Ange-FTP, when Tramp is unloaded. ;;;*** +;;;### (autoloads nil "tramp-sudoedit" "net/tramp-sudoedit.el" (0 +;;;;;; 0 0 0)) +;;; Generated autoloads from net/tramp-sudoedit.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "tramp-sudoedit" '("tramp-sudoedit-"))) + +;;;*** + ;;;### (autoloads nil "tramp-uu" "net/tramp-uu.el" (0 0 0 0)) ;;; Generated autoloads from net/tramp-uu.el @@ -36260,7 +36271,12 @@ first backend that could register the file is used. \(fn &optional VC-FILESET COMMENT)" t nil) (autoload 'vc-version-diff "vc" "\ -Report diffs between revisions of the fileset in the repository history. +Report diffs between REV1 and REV2 revisions of the fileset. + +\(fn FILES REV1 REV2)" t nil) + +(autoload 'vc-root-version-diff "vc" "\ +Report diffs between REV1 and REV2 revisions of the whole tree. \(fn FILES REV1 REV2)" t nil)