aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/src/eval.c b/src/eval.c
index 32b9d366fc3..5fa9a945ef5 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -90,7 +90,7 @@ Lisp_Object Vautoload_queue;
90 90
91/* Current number of specbindings allocated in specpdl. */ 91/* Current number of specbindings allocated in specpdl. */
92 92
93EMACS_INT specpdl_size; 93ptrdiff_t specpdl_size;
94 94
95/* Pointer to beginning of specpdl. */ 95/* Pointer to beginning of specpdl. */
96 96
@@ -111,7 +111,7 @@ static EMACS_INT lisp_eval_depth;
111 signal the error instead of entering an infinite loop of debugger 111 signal the error instead of entering an infinite loop of debugger
112 invocations. */ 112 invocations. */
113 113
114static int when_entered_debugger; 114static EMACS_INT when_entered_debugger;
115 115
116/* The function from which the last `signal' was called. Set in 116/* The function from which the last `signal' was called. Set in
117 Fsignal. */ 117 Fsignal. */
@@ -177,7 +177,7 @@ static Lisp_Object
177call_debugger (Lisp_Object arg) 177call_debugger (Lisp_Object arg)
178{ 178{
179 int debug_while_redisplaying; 179 int debug_while_redisplaying;
180 int count = SPECPDL_INDEX (); 180 ptrdiff_t count = SPECPDL_INDEX ();
181 Lisp_Object val; 181 Lisp_Object val;
182 EMACS_INT old_max = max_specpdl_size; 182 EMACS_INT old_max = max_specpdl_size;
183 183
@@ -758,8 +758,8 @@ The return value is BASE-VARIABLE. */)
758 { 758 {
759 struct specbinding *p; 759 struct specbinding *p;
760 760
761 for (p = specpdl_ptr - 1; p >= specpdl; p--) 761 for (p = specpdl_ptr; p > specpdl; p)
762 if (p->func == NULL 762 if ((--p)->func == NULL
763 && (EQ (new_alias, 763 && (EQ (new_alias,
764 CONSP (p->symbol) ? XCAR (p->symbol) : p->symbol))) 764 CONSP (p->symbol) ? XCAR (p->symbol) : p->symbol)))
765 error ("Don't know how to make a let-bound variable an alias"); 765 error ("Don't know how to make a let-bound variable an alias");
@@ -833,9 +833,9 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
833 { /* Check if there is really a global binding rather than just a let 833 { /* Check if there is really a global binding rather than just a let
834 binding that shadows the global unboundness of the var. */ 834 binding that shadows the global unboundness of the var. */
835 volatile struct specbinding *pdl = specpdl_ptr; 835 volatile struct specbinding *pdl = specpdl_ptr;
836 while (--pdl >= specpdl) 836 while (pdl > specpdl)
837 { 837 {
838 if (EQ (pdl->symbol, sym) && !pdl->func 838 if (EQ ((--pdl)->symbol, sym) && !pdl->func
839 && EQ (pdl->old_value, Qunbound)) 839 && EQ (pdl->old_value, Qunbound))
840 { 840 {
841 message_with_string ("Warning: defvar ignored because %s is let-bound", 841 message_with_string ("Warning: defvar ignored because %s is let-bound",
@@ -983,7 +983,7 @@ usage: (let* VARLIST BODY...) */)
983 (Lisp_Object args) 983 (Lisp_Object args)
984{ 984{
985 Lisp_Object varlist, var, val, elt, lexenv; 985 Lisp_Object varlist, var, val, elt, lexenv;
986 int count = SPECPDL_INDEX (); 986 ptrdiff_t count = SPECPDL_INDEX ();
987 struct gcpro gcpro1, gcpro2, gcpro3; 987 struct gcpro gcpro1, gcpro2, gcpro3;
988 988
989 GCPRO3 (args, elt, varlist); 989 GCPRO3 (args, elt, varlist);
@@ -1046,7 +1046,7 @@ usage: (let VARLIST BODY...) */)
1046{ 1046{
1047 Lisp_Object *temps, tem, lexenv; 1047 Lisp_Object *temps, tem, lexenv;
1048 register Lisp_Object elt, varlist; 1048 register Lisp_Object elt, varlist;
1049 int count = SPECPDL_INDEX (); 1049 ptrdiff_t count = SPECPDL_INDEX ();
1050 ptrdiff_t argnum; 1050 ptrdiff_t argnum;
1051 struct gcpro gcpro1, gcpro2; 1051 struct gcpro gcpro1, gcpro2;
1052 USE_SAFE_ALLOCA; 1052 USE_SAFE_ALLOCA;
@@ -1349,7 +1349,7 @@ usage: (unwind-protect BODYFORM UNWINDFORMS...) */)
1349 (Lisp_Object args) 1349 (Lisp_Object args)
1350{ 1350{
1351 Lisp_Object val; 1351 Lisp_Object val;
1352 int count = SPECPDL_INDEX (); 1352 ptrdiff_t count = SPECPDL_INDEX ();
1353 1353
1354 record_unwind_protect (Fprogn, Fcdr (args)); 1354 record_unwind_protect (Fprogn, Fcdr (args));
1355 val = eval_sub (Fcar (args)); 1355 val = eval_sub (Fcar (args));
@@ -2123,7 +2123,7 @@ un_autoload (Lisp_Object oldqueue)
2123void 2123void
2124do_autoload (Lisp_Object fundef, Lisp_Object funname) 2124do_autoload (Lisp_Object fundef, Lisp_Object funname)
2125{ 2125{
2126 int count = SPECPDL_INDEX (); 2126 ptrdiff_t count = SPECPDL_INDEX ();
2127 Lisp_Object fun; 2127 Lisp_Object fun;
2128 struct gcpro gcpro1, gcpro2, gcpro3; 2128 struct gcpro gcpro1, gcpro2, gcpro3;
2129 2129
@@ -2170,7 +2170,7 @@ DEFUN ("eval", Feval, Seval, 1, 2, 0,
2170If LEXICAL is t, evaluate using lexical scoping. */) 2170If LEXICAL is t, evaluate using lexical scoping. */)
2171 (Lisp_Object form, Lisp_Object lexical) 2171 (Lisp_Object form, Lisp_Object lexical)
2172{ 2172{
2173 int count = SPECPDL_INDEX (); 2173 ptrdiff_t count = SPECPDL_INDEX ();
2174 specbind (Qinternal_interpreter_environment, 2174 specbind (Qinternal_interpreter_environment,
2175 NILP (lexical) ? Qnil : Fcons (Qt, Qnil)); 2175 NILP (lexical) ? Qnil : Fcons (Qt, Qnil));
2176 return unbind_to (count, eval_sub (form)); 2176 return unbind_to (count, eval_sub (form));
@@ -2404,7 +2404,8 @@ Thus, (apply '+ 1 2 '(3 4)) returns 10.
2404usage: (apply FUNCTION &rest ARGUMENTS) */) 2404usage: (apply FUNCTION &rest ARGUMENTS) */)
2405 (ptrdiff_t nargs, Lisp_Object *args) 2405 (ptrdiff_t nargs, Lisp_Object *args)
2406{ 2406{
2407 ptrdiff_t i, numargs; 2407 ptrdiff_t i;
2408 EMACS_INT numargs;
2408 register Lisp_Object spread_arg; 2409 register Lisp_Object spread_arg;
2409 register Lisp_Object *funcall_args; 2410 register Lisp_Object *funcall_args;
2410 Lisp_Object fun, retval; 2411 Lisp_Object fun, retval;
@@ -3054,7 +3055,8 @@ static Lisp_Object
3054apply_lambda (Lisp_Object fun, Lisp_Object args) 3055apply_lambda (Lisp_Object fun, Lisp_Object args)
3055{ 3056{
3056 Lisp_Object args_left; 3057 Lisp_Object args_left;
3057 ptrdiff_t i, numargs; 3058 ptrdiff_t i;
3059 EMACS_INT numargs;
3058 register Lisp_Object *arg_vector; 3060 register Lisp_Object *arg_vector;
3059 struct gcpro gcpro1, gcpro2, gcpro3; 3061 struct gcpro gcpro1, gcpro2, gcpro3;
3060 register Lisp_Object tem; 3062 register Lisp_Object tem;
@@ -3099,7 +3101,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
3099 register Lisp_Object *arg_vector) 3101 register Lisp_Object *arg_vector)
3100{ 3102{
3101 Lisp_Object val, syms_left, next, lexenv; 3103 Lisp_Object val, syms_left, next, lexenv;
3102 int count = SPECPDL_INDEX (); 3104 ptrdiff_t count = SPECPDL_INDEX ();
3103 ptrdiff_t i; 3105 ptrdiff_t i;
3104 int optional, rest; 3106 int optional, rest;
3105 3107
@@ -3238,12 +3240,8 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
3238static void 3240static void
3239grow_specpdl (void) 3241grow_specpdl (void)
3240{ 3242{
3241 register int count = SPECPDL_INDEX (); 3243 register ptrdiff_t count = SPECPDL_INDEX ();
3242 int max_size = 3244 ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX);
3243 min (max_specpdl_size,
3244 min (max (PTRDIFF_MAX, SIZE_MAX) / sizeof (struct specbinding),
3245 INT_MAX));
3246 int size;
3247 if (max_size <= specpdl_size) 3245 if (max_size <= specpdl_size)
3248 { 3246 {
3249 if (max_specpdl_size < 400) 3247 if (max_specpdl_size < 400)
@@ -3251,9 +3249,7 @@ grow_specpdl (void)
3251 if (max_size <= specpdl_size) 3249 if (max_size <= specpdl_size)
3252 signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil); 3250 signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil);
3253 } 3251 }
3254 size = specpdl_size < max_size / 2 ? 2 * specpdl_size : max_size; 3252 specpdl = xpalloc (specpdl, &specpdl_size, 1, max_size, sizeof *specpdl);
3255 specpdl = xnrealloc (specpdl, size, sizeof *specpdl);
3256 specpdl_size = size;
3257 specpdl_ptr = specpdl + count; 3253 specpdl_ptr = specpdl + count;
3258} 3254}
3259 3255
@@ -3383,7 +3379,7 @@ record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg)
3383} 3379}
3384 3380
3385Lisp_Object 3381Lisp_Object
3386unbind_to (int count, Lisp_Object value) 3382unbind_to (ptrdiff_t count, Lisp_Object value)
3387{ 3383{
3388 Lisp_Object quitf = Vquit_flag; 3384 Lisp_Object quitf = Vquit_flag;
3389 struct gcpro gcpro1, gcpro2; 3385 struct gcpro gcpro1, gcpro2;
@@ -3463,7 +3459,7 @@ The debugger is entered when that frame exits, if the flag is non-nil. */)
3463 (Lisp_Object level, Lisp_Object flag) 3459 (Lisp_Object level, Lisp_Object flag)
3464{ 3460{
3465 register struct backtrace *backlist = backtrace_list; 3461 register struct backtrace *backlist = backtrace_list;
3466 register int i; 3462 register EMACS_INT i;
3467 3463
3468 CHECK_NUMBER (level); 3464 CHECK_NUMBER (level);
3469 3465