Commit b80559be authored by Paul Eggert's avatar Paul Eggert
Browse files

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.
parent a354736e
Pipeline #2825 failed with stage
in 90 minutes and 2 seconds
...@@ -224,7 +224,7 @@ struct emacs_globals globals; ...@@ -224,7 +224,7 @@ struct emacs_globals globals;
/* maybe_gc collects garbage if this goes negative. */ /* maybe_gc collects garbage if this goes negative. */
consing_ct consing_until_gc; intmax_t consing_until_gc;
#ifdef HAVE_PDUMPER #ifdef HAVE_PDUMPER
/* Number of finalizers run: used to loop over GC until we stop /* Number of finalizers run: used to loop over GC until we stop
...@@ -2547,7 +2547,7 @@ free_cons (struct Lisp_Cons *ptr) ...@@ -2547,7 +2547,7 @@ free_cons (struct Lisp_Cons *ptr)
might incorrectly return non-zero. */ might incorrectly return non-zero. */
int incr = sizeof *ptr; int incr = sizeof *ptr;
if (INT_ADD_WRAPV (consing_until_gc, incr, &consing_until_gc)) if (INT_ADD_WRAPV (consing_until_gc, incr, &consing_until_gc))
consing_until_gc = CONSING_CT_MAX; consing_until_gc = INTMAX_MAX;
gcstat.total_free_conses++; gcstat.total_free_conses++;
} }
...@@ -5502,7 +5502,7 @@ staticpro (Lisp_Object const *varaddress) ...@@ -5502,7 +5502,7 @@ staticpro (Lisp_Object const *varaddress)
static void static void
allow_garbage_collection (intmax_t consing) allow_garbage_collection (intmax_t consing)
{ {
consing_until_gc = consing - (CONSING_CT_MAX - consing_until_gc); consing_until_gc = consing - (INTMAX_MAX - consing_until_gc);
garbage_collection_inhibited--; garbage_collection_inhibited--;
} }
...@@ -5512,7 +5512,7 @@ inhibit_garbage_collection (void) ...@@ -5512,7 +5512,7 @@ inhibit_garbage_collection (void)
ptrdiff_t count = SPECPDL_INDEX (); ptrdiff_t count = SPECPDL_INDEX ();
record_unwind_protect_intmax (allow_garbage_collection, consing_until_gc); record_unwind_protect_intmax (allow_garbage_collection, consing_until_gc);
garbage_collection_inhibited++; garbage_collection_inhibited++;
consing_until_gc = CONSING_CT_MAX; consing_until_gc = INTMAX_MAX;
return count; return count;
} }
...@@ -5818,7 +5818,7 @@ garbage_collect_1 (struct gcstat *gcst) ...@@ -5818,7 +5818,7 @@ garbage_collect_1 (struct gcstat *gcst)
/* In case user calls debug_print during GC, /* In case user calls debug_print during GC,
don't let that cause a recursive GC. */ don't let that cause a recursive GC. */
consing_until_gc = CONSING_CT_MAX; consing_until_gc = INTMAX_MAX;
/* Save what's currently displayed in the echo area. Don't do that /* Save what's currently displayed in the echo area. Don't do that
if we are GC'ing because we've run out of memory, since if we are GC'ing because we've run out of memory, since
...@@ -5933,17 +5933,17 @@ garbage_collect_1 (struct gcstat *gcst) ...@@ -5933,17 +5933,17 @@ garbage_collect_1 (struct gcstat *gcst)
consing_until_gc = memory_full_cons_threshold; consing_until_gc = memory_full_cons_threshold;
else else
{ {
consing_ct threshold = max (gc_cons_threshold, GC_DEFAULT_THRESHOLD / 10); intmax_t threshold = max (gc_cons_threshold, GC_DEFAULT_THRESHOLD / 10);
if (FLOATP (Vgc_cons_percentage)) if (FLOATP (Vgc_cons_percentage))
{ {
double tot = (XFLOAT_DATA (Vgc_cons_percentage) double tot = (XFLOAT_DATA (Vgc_cons_percentage)
* total_bytes_of_live_objects ()); * total_bytes_of_live_objects ());
if (threshold < tot) if (threshold < tot)
{ {
if (tot < CONSING_CT_MAX) if (tot < INTMAX_MAX)
threshold = tot; threshold = tot;
else else
threshold = CONSING_CT_MAX; threshold = INTMAX_MAX;
} }
} }
consing_until_gc = threshold; consing_until_gc = threshold;
......
...@@ -3793,13 +3793,7 @@ extern void flush_stack_call_func (void (*func) (void *arg), void *arg); ...@@ -3793,13 +3793,7 @@ extern void flush_stack_call_func (void (*func) (void *arg), void *arg);
extern void garbage_collect (void); extern void garbage_collect (void);
extern const char *pending_malloc_warning; extern const char *pending_malloc_warning;
extern Lisp_Object zero_vector; extern Lisp_Object zero_vector;
#define CONSING_CT_MAX max (INTPTR_MAX, EMACS_INT_MAX) extern intmax_t consing_until_gc;
#if CONSING_CT_MAX == INTPTR_MAX
typedef intptr_t consing_ct;
#else
typedef EMACS_INT consing_ct;
#endif
extern consing_ct consing_until_gc;
#ifdef HAVE_PDUMPER #ifdef HAVE_PDUMPER
extern int number_finalizers_run; extern int number_finalizers_run;
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment