aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2019-08-13 12:20:40 -0700
committerPaul Eggert2019-08-13 12:22:30 -0700
commitb80559be212292d44ce14ca5e94505cab4d9a868 (patch)
treed32c29befdc953b97eaf643c945a37341d340519 /src
parenta354736e1dfe5a7e4ddbb1ee7f1373be2b5bbe09 (diff)
downloademacs-b80559be212292d44ce14ca5e94505cab4d9a868.tar.gz
emacs-b80559be212292d44ce14ca5e94505cab4d9a868.zip
Let consing_until_gc exceed EMACS_INT_MAX
This builds on the previous patch. * src/alloc.c (consing_until_gc): Now of type intmax_t, since gc-cons-threshold can be up to INTMAX_MAX. All uses changed. * src/lisp.h (CONSING_CT_MAX, consing_ct): Remove.
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c16
-rw-r--r--src/lisp.h8
2 files changed, 9 insertions, 15 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 7bed3f4488d..14b0a7b8381 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -224,7 +224,7 @@ struct emacs_globals globals;
224 224
225/* maybe_gc collects garbage if this goes negative. */ 225/* maybe_gc collects garbage if this goes negative. */
226 226
227consing_ct consing_until_gc; 227intmax_t consing_until_gc;
228 228
229#ifdef HAVE_PDUMPER 229#ifdef HAVE_PDUMPER
230/* Number of finalizers run: used to loop over GC until we stop 230/* Number of finalizers run: used to loop over GC until we stop
@@ -2547,7 +2547,7 @@ free_cons (struct Lisp_Cons *ptr)
2547 might incorrectly return non-zero. */ 2547 might incorrectly return non-zero. */
2548 int incr = sizeof *ptr; 2548 int incr = sizeof *ptr;
2549 if (INT_ADD_WRAPV (consing_until_gc, incr, &consing_until_gc)) 2549 if (INT_ADD_WRAPV (consing_until_gc, incr, &consing_until_gc))
2550 consing_until_gc = CONSING_CT_MAX; 2550 consing_until_gc = INTMAX_MAX;
2551 gcstat.total_free_conses++; 2551 gcstat.total_free_conses++;
2552} 2552}
2553 2553
@@ -5502,7 +5502,7 @@ staticpro (Lisp_Object const *varaddress)
5502static void 5502static void
5503allow_garbage_collection (intmax_t consing) 5503allow_garbage_collection (intmax_t consing)
5504{ 5504{
5505 consing_until_gc = consing - (CONSING_CT_MAX - consing_until_gc); 5505 consing_until_gc = consing - (INTMAX_MAX - consing_until_gc);
5506 garbage_collection_inhibited--; 5506 garbage_collection_inhibited--;
5507} 5507}
5508 5508
@@ -5512,7 +5512,7 @@ inhibit_garbage_collection (void)
5512 ptrdiff_t count = SPECPDL_INDEX (); 5512 ptrdiff_t count = SPECPDL_INDEX ();
5513 record_unwind_protect_intmax (allow_garbage_collection, consing_until_gc); 5513 record_unwind_protect_intmax (allow_garbage_collection, consing_until_gc);
5514 garbage_collection_inhibited++; 5514 garbage_collection_inhibited++;
5515 consing_until_gc = CONSING_CT_MAX; 5515 consing_until_gc = INTMAX_MAX;
5516 return count; 5516 return count;
5517} 5517}
5518 5518
@@ -5818,7 +5818,7 @@ garbage_collect_1 (struct gcstat *gcst)
5818 5818
5819 /* In case user calls debug_print during GC, 5819 /* In case user calls debug_print during GC,
5820 don't let that cause a recursive GC. */ 5820 don't let that cause a recursive GC. */
5821 consing_until_gc = CONSING_CT_MAX; 5821 consing_until_gc = INTMAX_MAX;
5822 5822
5823 /* Save what's currently displayed in the echo area. Don't do that 5823 /* Save what's currently displayed in the echo area. Don't do that
5824 if we are GC'ing because we've run out of memory, since 5824 if we are GC'ing because we've run out of memory, since
@@ -5933,17 +5933,17 @@ garbage_collect_1 (struct gcstat *gcst)
5933 consing_until_gc = memory_full_cons_threshold; 5933 consing_until_gc = memory_full_cons_threshold;
5934 else 5934 else
5935 { 5935 {
5936 consing_ct threshold = max (gc_cons_threshold, GC_DEFAULT_THRESHOLD / 10); 5936 intmax_t threshold = max (gc_cons_threshold, GC_DEFAULT_THRESHOLD / 10);
5937 if (FLOATP (Vgc_cons_percentage)) 5937 if (FLOATP (Vgc_cons_percentage))
5938 { 5938 {
5939 double tot = (XFLOAT_DATA (Vgc_cons_percentage) 5939 double tot = (XFLOAT_DATA (Vgc_cons_percentage)
5940 * total_bytes_of_live_objects ()); 5940 * total_bytes_of_live_objects ());
5941 if (threshold < tot) 5941 if (threshold < tot)
5942 { 5942 {
5943 if (tot < CONSING_CT_MAX) 5943 if (tot < INTMAX_MAX)
5944 threshold = tot; 5944 threshold = tot;
5945 else 5945 else
5946 threshold = CONSING_CT_MAX; 5946 threshold = INTMAX_MAX;
5947 } 5947 }
5948 } 5948 }
5949 consing_until_gc = threshold; 5949 consing_until_gc = threshold;
diff --git a/src/lisp.h b/src/lisp.h
index 043f2f738e4..0370c52fad6 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3793,13 +3793,7 @@ extern void flush_stack_call_func (void (*func) (void *arg), void *arg);
3793extern void garbage_collect (void); 3793extern void garbage_collect (void);
3794extern const char *pending_malloc_warning; 3794extern const char *pending_malloc_warning;
3795extern Lisp_Object zero_vector; 3795extern Lisp_Object zero_vector;
3796#define CONSING_CT_MAX max (INTPTR_MAX, EMACS_INT_MAX) 3796extern intmax_t consing_until_gc;
3797#if CONSING_CT_MAX == INTPTR_MAX
3798typedef intptr_t consing_ct;
3799#else
3800typedef EMACS_INT consing_ct;
3801#endif
3802extern consing_ct consing_until_gc;
3803#ifdef HAVE_PDUMPER 3797#ifdef HAVE_PDUMPER
3804extern int number_finalizers_run; 3798extern int number_finalizers_run;
3805#endif 3799#endif