diff options
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/src/eval.c b/src/eval.c index ae9b18da0bd..d1c45fca56b 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -65,7 +65,7 @@ union specbinding *backtrace_next (union specbinding *) EXTERNALLY_VISIBLE; | |||
| 65 | union specbinding *backtrace_top (void) EXTERNALLY_VISIBLE; | 65 | union specbinding *backtrace_top (void) EXTERNALLY_VISIBLE; |
| 66 | 66 | ||
| 67 | static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); | 67 | static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); |
| 68 | static Lisp_Object apply_lambda (Lisp_Object, Lisp_Object, ptrdiff_t); | 68 | static Lisp_Object apply_lambda (Lisp_Object, Lisp_Object, specpdl_ref); |
| 69 | static Lisp_Object lambda_arity (Lisp_Object); | 69 | static Lisp_Object lambda_arity (Lisp_Object); |
| 70 | 70 | ||
| 71 | static Lisp_Object | 71 | static Lisp_Object |
| @@ -282,11 +282,12 @@ Lisp_Object | |||
| 282 | call_debugger (Lisp_Object arg) | 282 | call_debugger (Lisp_Object arg) |
| 283 | { | 283 | { |
| 284 | bool debug_while_redisplaying; | 284 | bool debug_while_redisplaying; |
| 285 | ptrdiff_t count = SPECPDL_INDEX (); | 285 | specpdl_ref count = SPECPDL_INDEX (); |
| 286 | Lisp_Object val; | 286 | Lisp_Object val; |
| 287 | intmax_t old_depth = max_lisp_eval_depth; | 287 | intmax_t old_depth = max_lisp_eval_depth; |
| 288 | /* Do not allow max_specpdl_size less than actual depth (Bug#16603). */ | 288 | /* Do not allow max_specpdl_size less than actual depth (Bug#16603). */ |
| 289 | intmax_t old_max = max (max_specpdl_size, count); | 289 | ptrdiff_t counti = specpdl_ref_to_count (count); |
| 290 | intmax_t old_max = max (max_specpdl_size, counti); | ||
| 290 | 291 | ||
| 291 | /* The previous value of 40 is too small now that the debugger | 292 | /* The previous value of 40 is too small now that the debugger |
| 292 | prints using cl-prin1 instead of prin1. Printing lists nested 8 | 293 | prints using cl-prin1 instead of prin1. Printing lists nested 8 |
| @@ -296,9 +297,9 @@ call_debugger (Lisp_Object arg) | |||
| 296 | 297 | ||
| 297 | /* While debugging Bug#16603, previous value of 100 was found | 298 | /* While debugging Bug#16603, previous value of 100 was found |
| 298 | too small to avoid specpdl overflow in the debugger itself. */ | 299 | too small to avoid specpdl overflow in the debugger itself. */ |
| 299 | max_ensure_room (&max_specpdl_size, count, 200); | 300 | max_ensure_room (&max_specpdl_size, counti, 200); |
| 300 | 301 | ||
| 301 | if (old_max == count) | 302 | if (old_max == counti) |
| 302 | { | 303 | { |
| 303 | /* We can enter the debugger due to specpdl overflow (Bug#16603). */ | 304 | /* We can enter the debugger due to specpdl overflow (Bug#16603). */ |
| 304 | specpdl_ptr--; | 305 | specpdl_ptr--; |
| @@ -348,10 +349,10 @@ call_debugger (Lisp_Object arg) | |||
| 348 | } | 349 | } |
| 349 | 350 | ||
| 350 | void | 351 | void |
| 351 | do_debug_on_call (Lisp_Object code, ptrdiff_t count) | 352 | do_debug_on_call (Lisp_Object code, specpdl_ref count) |
| 352 | { | 353 | { |
| 353 | debug_on_next_call = 0; | 354 | debug_on_next_call = 0; |
| 354 | set_backtrace_debug_on_exit (specpdl + count, true); | 355 | set_backtrace_debug_on_exit (specpdl_ref_to_ptr (count), true); |
| 355 | call_debugger (list1 (code)); | 356 | call_debugger (list1 (code)); |
| 356 | } | 357 | } |
| 357 | 358 | ||
| @@ -929,7 +930,7 @@ usage: (let* VARLIST BODY...) */) | |||
| 929 | (Lisp_Object args) | 930 | (Lisp_Object args) |
| 930 | { | 931 | { |
| 931 | Lisp_Object var, val, elt, lexenv; | 932 | Lisp_Object var, val, elt, lexenv; |
| 932 | ptrdiff_t count = SPECPDL_INDEX (); | 933 | specpdl_ref count = SPECPDL_INDEX (); |
| 933 | 934 | ||
| 934 | lexenv = Vinternal_interpreter_environment; | 935 | lexenv = Vinternal_interpreter_environment; |
| 935 | 936 | ||
| @@ -989,7 +990,7 @@ usage: (let VARLIST BODY...) */) | |||
| 989 | { | 990 | { |
| 990 | Lisp_Object *temps, tem, lexenv; | 991 | Lisp_Object *temps, tem, lexenv; |
| 991 | Lisp_Object elt; | 992 | Lisp_Object elt; |
| 992 | ptrdiff_t count = SPECPDL_INDEX (); | 993 | specpdl_ref count = SPECPDL_INDEX (); |
| 993 | ptrdiff_t argnum; | 994 | ptrdiff_t argnum; |
| 994 | USE_SAFE_ALLOCA; | 995 | USE_SAFE_ALLOCA; |
| 995 | 996 | ||
| @@ -1093,7 +1094,7 @@ If FUNCTION takes less time to execute than TIMEOUT seconds, MESSAGE | |||
| 1093 | is not displayed. */) | 1094 | is not displayed. */) |
| 1094 | (Lisp_Object timeout, Lisp_Object message, Lisp_Object function) | 1095 | (Lisp_Object timeout, Lisp_Object message, Lisp_Object function) |
| 1095 | { | 1096 | { |
| 1096 | ptrdiff_t count = SPECPDL_INDEX (); | 1097 | specpdl_ref count = SPECPDL_INDEX (); |
| 1097 | 1098 | ||
| 1098 | CHECK_NUMBER (timeout); | 1099 | CHECK_NUMBER (timeout); |
| 1099 | CHECK_STRING (message); | 1100 | CHECK_STRING (message); |
| @@ -1306,7 +1307,7 @@ usage: (unwind-protect BODYFORM UNWINDFORMS...) */) | |||
| 1306 | (Lisp_Object args) | 1307 | (Lisp_Object args) |
| 1307 | { | 1308 | { |
| 1308 | Lisp_Object val; | 1309 | Lisp_Object val; |
| 1309 | ptrdiff_t count = SPECPDL_INDEX (); | 1310 | specpdl_ref count = SPECPDL_INDEX (); |
| 1310 | 1311 | ||
| 1311 | record_unwind_protect (prog_ignore, XCDR (args)); | 1312 | record_unwind_protect (prog_ignore, XCDR (args)); |
| 1312 | val = eval_sub (XCAR (args)); | 1313 | val = eval_sub (XCAR (args)); |
| @@ -1430,7 +1431,7 @@ internal_lisp_condition_case (Lisp_Object var, Lisp_Object bodyform, | |||
| 1430 | /* Bind HANDLER_VAR to VAL while evaluating HANDLER_BODY. | 1431 | /* Bind HANDLER_VAR to VAL while evaluating HANDLER_BODY. |
| 1431 | The unbind_to undoes just this binding; whoever longjumped | 1432 | The unbind_to undoes just this binding; whoever longjumped |
| 1432 | to us unwound the stack to C->pdlcount before throwing. */ | 1433 | to us unwound the stack to C->pdlcount before throwing. */ |
| 1433 | ptrdiff_t count = SPECPDL_INDEX (); | 1434 | specpdl_ref count = SPECPDL_INDEX (); |
| 1434 | specbind (handler_var, val); | 1435 | specbind (handler_var, val); |
| 1435 | return unbind_to (count, Fprogn (handler_body)); | 1436 | return unbind_to (count, Fprogn (handler_body)); |
| 1436 | } | 1437 | } |
| @@ -1451,7 +1452,7 @@ internal_lisp_condition_case (Lisp_Object var, Lisp_Object bodyform, | |||
| 1451 | handler_var = Qinternal_interpreter_environment; | 1452 | handler_var = Qinternal_interpreter_environment; |
| 1452 | } | 1453 | } |
| 1453 | 1454 | ||
| 1454 | ptrdiff_t count = SPECPDL_INDEX (); | 1455 | specpdl_ref count = SPECPDL_INDEX (); |
| 1455 | specbind (handler_var, result); | 1456 | specbind (handler_var, result); |
| 1456 | return unbind_to (count, Fprogn (success_handler)); | 1457 | return unbind_to (count, Fprogn (success_handler)); |
| 1457 | } | 1458 | } |
| @@ -1815,7 +1816,8 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit) | |||
| 1815 | { | 1816 | { |
| 1816 | /* Edebug takes care of restoring these variables when it exits. */ | 1817 | /* Edebug takes care of restoring these variables when it exits. */ |
| 1817 | max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 20); | 1818 | max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 20); |
| 1818 | max_ensure_room (&max_specpdl_size, SPECPDL_INDEX (), 40); | 1819 | ptrdiff_t counti = specpdl_ref_to_count (SPECPDL_INDEX ()); |
| 1820 | max_ensure_room (&max_specpdl_size, counti, 40); | ||
| 1819 | 1821 | ||
| 1820 | call2 (Vsignal_hook_function, error_symbol, data); | 1822 | call2 (Vsignal_hook_function, error_symbol, data); |
| 1821 | } | 1823 | } |
| @@ -1883,8 +1885,9 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object data, bool keyboard_quit) | |||
| 1883 | && !NILP (Ffboundp (Qdebug_early))) | 1885 | && !NILP (Ffboundp (Qdebug_early))) |
| 1884 | { | 1886 | { |
| 1885 | max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 100); | 1887 | max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 100); |
| 1886 | max_ensure_room (&max_specpdl_size, SPECPDL_INDEX (), 200); | 1888 | specpdl_ref count = SPECPDL_INDEX (); |
| 1887 | ptrdiff_t count = SPECPDL_INDEX (); | 1889 | ptrdiff_t counti = specpdl_ref_to_count (count); |
| 1890 | max_ensure_room (&max_specpdl_size, counti, 200); | ||
| 1888 | specbind (Qdebugger, Qdebug_early); | 1891 | specbind (Qdebugger, Qdebug_early); |
| 1889 | call_debugger (list2 (Qerror, Fcons (error_symbol, data))); | 1892 | call_debugger (list2 (Qerror, Fcons (error_symbol, data))); |
| 1890 | unbind_to (count, Qnil); | 1893 | unbind_to (count, Qnil); |
| @@ -2271,7 +2274,7 @@ load_with_autoload_queue | |||
| 2271 | (Lisp_Object file, Lisp_Object noerror, Lisp_Object nomessage, | 2274 | (Lisp_Object file, Lisp_Object noerror, Lisp_Object nomessage, |
| 2272 | Lisp_Object nosuffix, Lisp_Object must_suffix) | 2275 | Lisp_Object nosuffix, Lisp_Object must_suffix) |
| 2273 | { | 2276 | { |
| 2274 | ptrdiff_t count = SPECPDL_INDEX (); | 2277 | specpdl_ref count = SPECPDL_INDEX (); |
| 2275 | 2278 | ||
| 2276 | /* If autoloading gets an error (which includes the error of failing | 2279 | /* If autoloading gets an error (which includes the error of failing |
| 2277 | to define the function being called), we use Vautoload_queue | 2280 | to define the function being called), we use Vautoload_queue |
| @@ -2350,7 +2353,7 @@ LEXICAL can also be an actual lexical environment, in the form of an | |||
| 2350 | alist mapping symbols to their value. */) | 2353 | alist mapping symbols to their value. */) |
| 2351 | (Lisp_Object form, Lisp_Object lexical) | 2354 | (Lisp_Object form, Lisp_Object lexical) |
| 2352 | { | 2355 | { |
| 2353 | ptrdiff_t count = SPECPDL_INDEX (); | 2356 | specpdl_ref count = SPECPDL_INDEX (); |
| 2354 | specbind (Qinternal_interpreter_environment, | 2357 | specbind (Qinternal_interpreter_environment, |
| 2355 | CONSP (lexical) || NILP (lexical) ? lexical : list1 (Qt)); | 2358 | CONSP (lexical) || NILP (lexical) ? lexical : list1 (Qt)); |
| 2356 | return unbind_to (count, eval_sub (form)); | 2359 | return unbind_to (count, eval_sub (form)); |
| @@ -2361,7 +2364,7 @@ grow_specpdl_allocation (void) | |||
| 2361 | { | 2364 | { |
| 2362 | eassert (specpdl_ptr == specpdl + specpdl_size); | 2365 | eassert (specpdl_ptr == specpdl + specpdl_size); |
| 2363 | 2366 | ||
| 2364 | ptrdiff_t count = SPECPDL_INDEX (); | 2367 | specpdl_ref count = SPECPDL_INDEX (); |
| 2365 | ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX - 1000); | 2368 | ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX - 1000); |
| 2366 | union specbinding *pdlvec = specpdl - 1; | 2369 | union specbinding *pdlvec = specpdl - 1; |
| 2367 | ptrdiff_t pdlvecsize = specpdl_size + 1; | 2370 | ptrdiff_t pdlvecsize = specpdl_size + 1; |
| @@ -2375,7 +2378,7 @@ grow_specpdl_allocation (void) | |||
| 2375 | pdlvec = xpalloc (pdlvec, &pdlvecsize, 1, max_size + 1, sizeof *specpdl); | 2378 | pdlvec = xpalloc (pdlvec, &pdlvecsize, 1, max_size + 1, sizeof *specpdl); |
| 2376 | specpdl = pdlvec + 1; | 2379 | specpdl = pdlvec + 1; |
| 2377 | specpdl_size = pdlvecsize - 1; | 2380 | specpdl_size = pdlvecsize - 1; |
| 2378 | specpdl_ptr = specpdl + count; | 2381 | specpdl_ptr = specpdl_ref_to_ptr (count); |
| 2379 | } | 2382 | } |
| 2380 | 2383 | ||
| 2381 | /* Grow the specpdl stack by one entry. | 2384 | /* Grow the specpdl stack by one entry. |
| @@ -2396,10 +2399,10 @@ grow_specpdl (void) | |||
| 2396 | grow_specpdl_allocation (); | 2399 | grow_specpdl_allocation (); |
| 2397 | } | 2400 | } |
| 2398 | 2401 | ||
| 2399 | ptrdiff_t | 2402 | specpdl_ref |
| 2400 | record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs) | 2403 | record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs) |
| 2401 | { | 2404 | { |
| 2402 | ptrdiff_t count = SPECPDL_INDEX (); | 2405 | specpdl_ref count = SPECPDL_INDEX (); |
| 2403 | 2406 | ||
| 2404 | eassert (nargs >= UNEVALLED); | 2407 | eassert (nargs >= UNEVALLED); |
| 2405 | specpdl_ptr->bt.kind = SPECPDL_BACKTRACE; | 2408 | specpdl_ptr->bt.kind = SPECPDL_BACKTRACE; |
| @@ -2449,7 +2452,7 @@ eval_sub (Lisp_Object form) | |||
| 2449 | CHECK_LIST (original_args); | 2452 | CHECK_LIST (original_args); |
| 2450 | 2453 | ||
| 2451 | /* This also protects them from gc. */ | 2454 | /* This also protects them from gc. */ |
| 2452 | ptrdiff_t count | 2455 | specpdl_ref count |
| 2453 | = record_in_backtrace (original_fun, &original_args, UNEVALLED); | 2456 | = record_in_backtrace (original_fun, &original_args, UNEVALLED); |
| 2454 | 2457 | ||
| 2455 | if (debug_on_next_call) | 2458 | if (debug_on_next_call) |
| @@ -2498,13 +2501,13 @@ eval_sub (Lisp_Object form) | |||
| 2498 | vals[argnum++] = eval_sub (arg); | 2501 | vals[argnum++] = eval_sub (arg); |
| 2499 | } | 2502 | } |
| 2500 | 2503 | ||
| 2501 | set_backtrace_args (specpdl + count, vals, argnum); | 2504 | set_backtrace_args (specpdl_ref_to_ptr (count), vals, argnum); |
| 2502 | 2505 | ||
| 2503 | val = XSUBR (fun)->function.aMANY (argnum, vals); | 2506 | val = XSUBR (fun)->function.aMANY (argnum, vals); |
| 2504 | 2507 | ||
| 2505 | lisp_eval_depth--; | 2508 | lisp_eval_depth--; |
| 2506 | /* Do the debug-on-exit now, while VALS still exists. */ | 2509 | /* Do the debug-on-exit now, while VALS still exists. */ |
| 2507 | if (backtrace_debug_on_exit (specpdl + count)) | 2510 | if (backtrace_debug_on_exit (specpdl_ref_to_ptr (count))) |
| 2508 | val = call_debugger (list2 (Qexit, val)); | 2511 | val = call_debugger (list2 (Qexit, val)); |
| 2509 | SAFE_FREE (); | 2512 | SAFE_FREE (); |
| 2510 | specpdl_ptr--; | 2513 | specpdl_ptr--; |
| @@ -2520,7 +2523,7 @@ eval_sub (Lisp_Object form) | |||
| 2520 | args_left = Fcdr (args_left); | 2523 | args_left = Fcdr (args_left); |
| 2521 | } | 2524 | } |
| 2522 | 2525 | ||
| 2523 | set_backtrace_args (specpdl + count, argvals, numargs); | 2526 | set_backtrace_args (specpdl_ref_to_ptr (count), argvals, numargs); |
| 2524 | 2527 | ||
| 2525 | switch (i) | 2528 | switch (i) |
| 2526 | { | 2529 | { |
| @@ -2592,7 +2595,7 @@ eval_sub (Lisp_Object form) | |||
| 2592 | } | 2595 | } |
| 2593 | if (EQ (funcar, Qmacro)) | 2596 | if (EQ (funcar, Qmacro)) |
| 2594 | { | 2597 | { |
| 2595 | ptrdiff_t count1 = SPECPDL_INDEX (); | 2598 | specpdl_ref count1 = SPECPDL_INDEX (); |
| 2596 | Lisp_Object exp; | 2599 | Lisp_Object exp; |
| 2597 | /* Bind lexical-binding during expansion of the macro, so the | 2600 | /* Bind lexical-binding during expansion of the macro, so the |
| 2598 | macro can know reliably if the code it outputs will be | 2601 | macro can know reliably if the code it outputs will be |
| @@ -2624,7 +2627,7 @@ eval_sub (Lisp_Object form) | |||
| 2624 | } | 2627 | } |
| 2625 | 2628 | ||
| 2626 | lisp_eval_depth--; | 2629 | lisp_eval_depth--; |
| 2627 | if (backtrace_debug_on_exit (specpdl + count)) | 2630 | if (backtrace_debug_on_exit (specpdl_ref_to_ptr (count))) |
| 2628 | val = call_debugger (list2 (Qexit, val)); | 2631 | val = call_debugger (list2 (Qexit, val)); |
| 2629 | specpdl_ptr--; | 2632 | specpdl_ptr--; |
| 2630 | 2633 | ||
| @@ -3070,7 +3073,7 @@ Thus, (funcall \\='cons \\='x \\='y) returns (x . y). | |||
| 3070 | usage: (funcall FUNCTION &rest ARGUMENTS) */) | 3073 | usage: (funcall FUNCTION &rest ARGUMENTS) */) |
| 3071 | (ptrdiff_t nargs, Lisp_Object *args) | 3074 | (ptrdiff_t nargs, Lisp_Object *args) |
| 3072 | { | 3075 | { |
| 3073 | ptrdiff_t count; | 3076 | specpdl_ref count; |
| 3074 | 3077 | ||
| 3075 | maybe_quit (); | 3078 | maybe_quit (); |
| 3076 | 3079 | ||
| @@ -3092,7 +3095,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 3092 | Lisp_Object val = funcall_general (args[0], nargs - 1, args + 1); | 3095 | Lisp_Object val = funcall_general (args[0], nargs - 1, args + 1); |
| 3093 | 3096 | ||
| 3094 | lisp_eval_depth--; | 3097 | lisp_eval_depth--; |
| 3095 | if (backtrace_debug_on_exit (specpdl + count)) | 3098 | if (backtrace_debug_on_exit (specpdl_ref_to_ptr (count))) |
| 3096 | val = call_debugger (list2 (Qexit, val)); | 3099 | val = call_debugger (list2 (Qexit, val)); |
| 3097 | specpdl_ptr--; | 3100 | specpdl_ptr--; |
| 3098 | return val; | 3101 | return val; |
| @@ -3183,7 +3186,7 @@ fetch_and_exec_byte_code (Lisp_Object fun, ptrdiff_t args_template, | |||
| 3183 | } | 3186 | } |
| 3184 | 3187 | ||
| 3185 | static Lisp_Object | 3188 | static Lisp_Object |
| 3186 | apply_lambda (Lisp_Object fun, Lisp_Object args, ptrdiff_t count) | 3189 | apply_lambda (Lisp_Object fun, Lisp_Object args, specpdl_ref count) |
| 3187 | { | 3190 | { |
| 3188 | Lisp_Object *arg_vector; | 3191 | Lisp_Object *arg_vector; |
| 3189 | Lisp_Object tem; | 3192 | Lisp_Object tem; |
| @@ -3200,12 +3203,12 @@ apply_lambda (Lisp_Object fun, Lisp_Object args, ptrdiff_t count) | |||
| 3200 | arg_vector[i] = tem; | 3203 | arg_vector[i] = tem; |
| 3201 | } | 3204 | } |
| 3202 | 3205 | ||
| 3203 | set_backtrace_args (specpdl + count, arg_vector, numargs); | 3206 | set_backtrace_args (specpdl_ref_to_ptr (count), arg_vector, numargs); |
| 3204 | tem = funcall_lambda (fun, numargs, arg_vector); | 3207 | tem = funcall_lambda (fun, numargs, arg_vector); |
| 3205 | 3208 | ||
| 3206 | lisp_eval_depth--; | 3209 | lisp_eval_depth--; |
| 3207 | /* Do the debug-on-exit now, while arg_vector still exists. */ | 3210 | /* Do the debug-on-exit now, while arg_vector still exists. */ |
| 3208 | if (backtrace_debug_on_exit (specpdl + count)) | 3211 | if (backtrace_debug_on_exit (specpdl_ref_to_ptr (count))) |
| 3209 | tem = call_debugger (list2 (Qexit, tem)); | 3212 | tem = call_debugger (list2 (Qexit, tem)); |
| 3210 | SAFE_FREE (); | 3213 | SAFE_FREE (); |
| 3211 | specpdl_ptr--; | 3214 | specpdl_ptr--; |
| @@ -3222,7 +3225,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, | |||
| 3222 | register Lisp_Object *arg_vector) | 3225 | register Lisp_Object *arg_vector) |
| 3223 | { | 3226 | { |
| 3224 | Lisp_Object val, syms_left, next, lexenv; | 3227 | Lisp_Object val, syms_left, next, lexenv; |
| 3225 | ptrdiff_t count = SPECPDL_INDEX (); | 3228 | specpdl_ref count = SPECPDL_INDEX (); |
| 3226 | ptrdiff_t i; | 3229 | ptrdiff_t i; |
| 3227 | bool optional, rest; | 3230 | bool optional, rest; |
| 3228 | 3231 | ||
| @@ -3820,9 +3823,9 @@ record_unwind_protect_nothing (void) | |||
| 3820 | It need not be at the top of the stack. */ | 3823 | It need not be at the top of the stack. */ |
| 3821 | 3824 | ||
| 3822 | void | 3825 | void |
| 3823 | clear_unwind_protect (ptrdiff_t count) | 3826 | clear_unwind_protect (specpdl_ref count) |
| 3824 | { | 3827 | { |
| 3825 | union specbinding *p = specpdl + count; | 3828 | union specbinding *p = specpdl_ref_to_ptr (count); |
| 3826 | p->unwind_void.kind = SPECPDL_UNWIND_VOID; | 3829 | p->unwind_void.kind = SPECPDL_UNWIND_VOID; |
| 3827 | p->unwind_void.func = do_nothing; | 3830 | p->unwind_void.func = do_nothing; |
| 3828 | } | 3831 | } |
| @@ -3832,10 +3835,10 @@ clear_unwind_protect (ptrdiff_t count) | |||
| 3832 | previous value without invoking it. */ | 3835 | previous value without invoking it. */ |
| 3833 | 3836 | ||
| 3834 | void | 3837 | void |
| 3835 | set_unwind_protect (ptrdiff_t count, void (*func) (Lisp_Object), | 3838 | set_unwind_protect (specpdl_ref count, void (*func) (Lisp_Object), |
| 3836 | Lisp_Object arg) | 3839 | Lisp_Object arg) |
| 3837 | { | 3840 | { |
| 3838 | union specbinding *p = specpdl + count; | 3841 | union specbinding *p = specpdl_ref_to_ptr (count); |
| 3839 | p->unwind.kind = SPECPDL_UNWIND; | 3842 | p->unwind.kind = SPECPDL_UNWIND; |
| 3840 | p->unwind.func = func; | 3843 | p->unwind.func = func; |
| 3841 | p->unwind.arg = arg; | 3844 | p->unwind.arg = arg; |
| @@ -3843,9 +3846,9 @@ set_unwind_protect (ptrdiff_t count, void (*func) (Lisp_Object), | |||
| 3843 | } | 3846 | } |
| 3844 | 3847 | ||
| 3845 | void | 3848 | void |
| 3846 | set_unwind_protect_ptr (ptrdiff_t count, void (*func) (void *), void *arg) | 3849 | set_unwind_protect_ptr (specpdl_ref count, void (*func) (void *), void *arg) |
| 3847 | { | 3850 | { |
| 3848 | union specbinding *p = specpdl + count; | 3851 | union specbinding *p = specpdl_ref_to_ptr (count); |
| 3849 | p->unwind_ptr.kind = SPECPDL_UNWIND_PTR; | 3852 | p->unwind_ptr.kind = SPECPDL_UNWIND_PTR; |
| 3850 | p->unwind_ptr.func = func; | 3853 | p->unwind_ptr.func = func; |
| 3851 | p->unwind_ptr.arg = arg; | 3854 | p->unwind_ptr.arg = arg; |
| @@ -3855,13 +3858,13 @@ set_unwind_protect_ptr (ptrdiff_t count, void (*func) (void *), void *arg) | |||
| 3855 | depth COUNT is reached. Return VALUE. */ | 3858 | depth COUNT is reached. Return VALUE. */ |
| 3856 | 3859 | ||
| 3857 | Lisp_Object | 3860 | Lisp_Object |
| 3858 | unbind_to (ptrdiff_t count, Lisp_Object value) | 3861 | unbind_to (specpdl_ref count, Lisp_Object value) |
| 3859 | { | 3862 | { |
| 3860 | Lisp_Object quitf = Vquit_flag; | 3863 | Lisp_Object quitf = Vquit_flag; |
| 3861 | 3864 | ||
| 3862 | Vquit_flag = Qnil; | 3865 | Vquit_flag = Qnil; |
| 3863 | 3866 | ||
| 3864 | while (specpdl_ptr != specpdl + count) | 3867 | while (specpdl_ptr != specpdl_ref_to_ptr (count)) |
| 3865 | { | 3868 | { |
| 3866 | /* Copy the binding, and decrement specpdl_ptr, before we do | 3869 | /* Copy the binding, and decrement specpdl_ptr, before we do |
| 3867 | the work to unbind it. We decrement first | 3870 | the work to unbind it. We decrement first |
| @@ -4152,7 +4155,7 @@ NFRAMES and BASE specify the activation frame to use, as in `backtrace-frame'. | |||
| 4152 | (Lisp_Object exp, Lisp_Object nframes, Lisp_Object base) | 4155 | (Lisp_Object exp, Lisp_Object nframes, Lisp_Object base) |
| 4153 | { | 4156 | { |
| 4154 | union specbinding *pdl = get_backtrace_frame (nframes, base); | 4157 | union specbinding *pdl = get_backtrace_frame (nframes, base); |
| 4155 | ptrdiff_t count = SPECPDL_INDEX (); | 4158 | specpdl_ref count = SPECPDL_INDEX (); |
| 4156 | ptrdiff_t distance = specpdl_ptr - pdl; | 4159 | ptrdiff_t distance = specpdl_ptr - pdl; |
| 4157 | eassert (distance >= 0); | 4160 | eassert (distance >= 0); |
| 4158 | 4161 | ||