summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/alloc.c8
-rw-r--r--src/eval.c16
-rw-r--r--src/lisp.h7
3 files changed, 26 insertions, 5 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 50015808e59..aa9200f2ebb 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5505,10 +5505,9 @@ staticpro (Lisp_Object const *varaddress)
consing_until_gc to speed up maybe_gc when GC is inhibited. */
static void
-allow_garbage_collection (void *ptr)
+allow_garbage_collection (intmax_t consing)
{
- object_ct *p = ptr;
- consing_until_gc = *p;
+ consing_until_gc = consing;
garbage_collection_inhibited--;
}
@@ -5516,8 +5515,7 @@ ptrdiff_t
inhibit_garbage_collection (void)
{
ptrdiff_t count = SPECPDL_INDEX ();
- object_ct consing = consing_until_gc;
- record_unwind_protect_ptr (allow_garbage_collection, &consing);
+ record_unwind_protect_intmax (allow_garbage_collection, consing_until_gc);
garbage_collection_inhibited++;
consing_until_gc = OBJECT_CT_MAX;
return count;
diff --git a/src/eval.c b/src/eval.c
index 02a6c3555a9..b890aa6f7f2 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -674,6 +674,7 @@ default_toplevel_binding (Lisp_Object symbol)
case SPECPDL_UNWIND_ARRAY:
case SPECPDL_UNWIND_PTR:
case SPECPDL_UNWIND_INT:
+ case SPECPDL_UNWIND_INTMAX:
case SPECPDL_UNWIND_EXCURSION:
case SPECPDL_UNWIND_VOID:
case SPECPDL_BACKTRACE:
@@ -3395,6 +3396,15 @@ record_unwind_protect_int (void (*function) (int), int arg)
}
void
+record_unwind_protect_intmax (void (*function) (intmax_t), intmax_t arg)
+{
+ specpdl_ptr->unwind_intmax.kind = SPECPDL_UNWIND_INTMAX;
+ specpdl_ptr->unwind_intmax.func = function;
+ specpdl_ptr->unwind_intmax.arg = arg;
+ grow_specpdl ();
+}
+
+void
record_unwind_protect_excursion (void)
{
specpdl_ptr->unwind_excursion.kind = SPECPDL_UNWIND_EXCURSION;
@@ -3448,6 +3458,9 @@ do_one_unbind (union specbinding *this_binding, bool unwinding,
case SPECPDL_UNWIND_INT:
this_binding->unwind_int.func (this_binding->unwind_int.arg);
break;
+ case SPECPDL_UNWIND_INTMAX:
+ this_binding->unwind_intmax.func (this_binding->unwind_intmax.arg);
+ break;
case SPECPDL_UNWIND_VOID:
this_binding->unwind_void.func ();
break;
@@ -3784,6 +3797,7 @@ backtrace_eval_unrewind (int distance)
case SPECPDL_UNWIND_ARRAY:
case SPECPDL_UNWIND_PTR:
case SPECPDL_UNWIND_INT:
+ case SPECPDL_UNWIND_INTMAX:
case SPECPDL_UNWIND_VOID:
case SPECPDL_BACKTRACE:
break;
@@ -3917,6 +3931,7 @@ NFRAMES and BASE specify the activation frame to use, as in `backtrace-frame'.
case SPECPDL_UNWIND_ARRAY:
case SPECPDL_UNWIND_PTR:
case SPECPDL_UNWIND_INT:
+ case SPECPDL_UNWIND_INTMAX:
case SPECPDL_UNWIND_EXCURSION:
case SPECPDL_UNWIND_VOID:
case SPECPDL_BACKTRACE:
@@ -3979,6 +3994,7 @@ mark_specpdl (union specbinding *first, union specbinding *ptr)
case SPECPDL_UNWIND_PTR:
case SPECPDL_UNWIND_INT:
+ case SPECPDL_UNWIND_INTMAX:
case SPECPDL_UNWIND_VOID:
break;
diff --git a/src/lisp.h b/src/lisp.h
index 6d101fed908..9d37629bc46 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3156,6 +3156,7 @@ enum specbind_tag {
Its elements are potential Lisp_Objects. */
SPECPDL_UNWIND_PTR, /* Likewise, on void *. */
SPECPDL_UNWIND_INT, /* Likewise, on int. */
+ SPECPDL_UNWIND_INTMAX, /* Likewise, on intmax_t. */
SPECPDL_UNWIND_EXCURSION, /* Likewise, on an execursion. */
SPECPDL_UNWIND_VOID, /* Likewise, with no arg. */
SPECPDL_BACKTRACE, /* An element of the backtrace. */
@@ -3193,6 +3194,11 @@ union specbinding
} unwind_int;
struct {
ENUM_BF (specbind_tag) kind : CHAR_BIT;
+ void (*func) (intmax_t);
+ intmax_t arg;
+ } unwind_intmax;
+ struct {
+ ENUM_BF (specbind_tag) kind : CHAR_BIT;
Lisp_Object marker, window;
} unwind_excursion;
struct {
@@ -4118,6 +4124,7 @@ extern void record_unwind_protect (void (*) (Lisp_Object), Lisp_Object);
extern void record_unwind_protect_array (Lisp_Object *, ptrdiff_t);
extern void record_unwind_protect_ptr (void (*) (void *), void *);
extern void record_unwind_protect_int (void (*) (int), int);
+extern void record_unwind_protect_intmax (void (*) (intmax_t), intmax_t);
extern void record_unwind_protect_void (void (*) (void));
extern void record_unwind_protect_excursion (void);
extern void record_unwind_protect_nothing (void);