aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorTom Tromey2013-07-06 23:18:58 -0600
committerTom Tromey2013-07-06 23:18:58 -0600
commit6dacdad5fcb278e5a16b38bb81786aac9ca27be4 (patch)
treef5f331ea361ba0f99e0f9b638d183ad492a7da31 /src/eval.c
parent0a6f2ff0c8ceb29703e76cddd46ea3f176dd873a (diff)
parent219afb88d9d484393418820d1c08dc93299110ec (diff)
downloademacs-6dacdad5fcb278e5a16b38bb81786aac9ca27be4.tar.gz
emacs-6dacdad5fcb278e5a16b38bb81786aac9ca27be4.zip
merge from trunk
this merges frmo trunk and fixes various build issues. this needed a few ugly tweaks. this hangs in "make check" now
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c218
1 files changed, 154 insertions, 64 deletions
diff --git a/src/eval.c b/src/eval.c
index 37ea81ba1cb..451a7b0cc28 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -76,17 +76,19 @@ Lisp_Object Vrun_hooks;
76 76
77Lisp_Object Vautoload_queue; 77Lisp_Object Vautoload_queue;
78 78
79/* Current number of specbindings allocated in specpdl. */ 79/* Current number of specbindings allocated in specpdl, not counting
80 the dummy entry specpdl[-1]. */
80 81
81/* ptrdiff_t specpdl_size; */ 82/* ptrdiff_t specpdl_size; */
82 83
83/* Pointer to beginning of specpdl. */ 84/* Pointer to beginning of specpdl. A dummy entry specpdl[-1] exists
85 only so that its address can be taken. */
84 86
85/* struct specbinding *specpdl; */ 87/* union specbinding *specpdl; */
86 88
87/* Pointer to first unused element in specpdl. */ 89/* Pointer to first unused element in specpdl. */
88 90
89/* struct specbinding *specpdl_ptr; */ 91/* union specbinding *specpdl_ptr; */
90 92
91/* Depth in Lisp evaluations and function calls. */ 93/* Depth in Lisp evaluations and function calls. */
92 94
@@ -115,40 +117,120 @@ Lisp_Object inhibit_lisp_code;
115static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); 117static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
116static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); 118static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
117 119
120static Lisp_Object
121specpdl_symbol (union specbinding *pdl)
122{
123 eassert (pdl->kind >= SPECPDL_LET);
124 return pdl->let.symbol;
125}
126
127static Lisp_Object
128specpdl_old_value (union specbinding *pdl)
129{
130 eassert (pdl->kind >= SPECPDL_LET);
131 return pdl->let.old_value;
132}
133
134static Lisp_Object
135specpdl_where (union specbinding *pdl)
136{
137 eassert (pdl->kind > SPECPDL_LET);
138 return pdl->let.where;
139}
140
141static Lisp_Object
142specpdl_saved_value (union specbinding *pdl)
143{
144 eassert (pdl->kind >= SPECPDL_LET);
145 return pdl->let.saved_value;
146}
147
148static Lisp_Object
149specpdl_arg (union specbinding *pdl)
150{
151 eassert (pdl->kind == SPECPDL_UNWIND);
152 return pdl->unwind.arg;
153}
154
155static specbinding_func
156specpdl_func (union specbinding *pdl)
157{
158 eassert (pdl->kind == SPECPDL_UNWIND);
159 return pdl->unwind.func;
160}
161
162static Lisp_Object
163backtrace_function (union specbinding *pdl)
164{
165 eassert (pdl->kind == SPECPDL_BACKTRACE);
166 return pdl->bt.function;
167}
168
169static ptrdiff_t
170backtrace_nargs (union specbinding *pdl)
171{
172 eassert (pdl->kind == SPECPDL_BACKTRACE);
173 return pdl->bt.nargs;
174}
175
176static Lisp_Object *
177backtrace_args (union specbinding *pdl)
178{
179 eassert (pdl->kind == SPECPDL_BACKTRACE);
180 return pdl->bt.args;
181}
182
183static bool
184backtrace_debug_on_exit (union specbinding *pdl)
185{
186 eassert (pdl->kind == SPECPDL_BACKTRACE);
187 return pdl->bt.debug_on_exit;
188}
189
118/* Functions to modify slots of backtrace records. */ 190/* Functions to modify slots of backtrace records. */
119 191
120static void 192static void
121set_backtrace_args (struct specbinding *pdl, Lisp_Object *args) 193set_backtrace_args (union specbinding *pdl, Lisp_Object *args)
122{ eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.args = args; } 194{
195 eassert (pdl->kind == SPECPDL_BACKTRACE);
196 pdl->bt.args = args;
197}
123 198
124static void 199static void
125set_backtrace_nargs (struct specbinding *pdl, ptrdiff_t n) 200set_backtrace_nargs (union specbinding *pdl, ptrdiff_t n)
126{ eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.nargs = n; } 201{
202 eassert (pdl->kind == SPECPDL_BACKTRACE);
203 pdl->bt.nargs = n;
204}
127 205
128static void 206static void
129set_backtrace_debug_on_exit (struct specbinding *pdl, bool doe) 207set_backtrace_debug_on_exit (union specbinding *pdl, bool doe)
130{ eassert (pdl->kind == SPECPDL_BACKTRACE); pdl->v.bt.debug_on_exit = doe; } 208{
209 eassert (pdl->kind == SPECPDL_BACKTRACE);
210 pdl->bt.debug_on_exit = doe;
211}
131 212
132/* Helper functions to scan the backtrace. */ 213/* Helper functions to scan the backtrace. */
133 214
134bool backtrace_p (struct specbinding *) EXTERNALLY_VISIBLE; 215bool backtrace_p (union specbinding *) EXTERNALLY_VISIBLE;
135struct specbinding *backtrace_top (void) EXTERNALLY_VISIBLE; 216union specbinding *backtrace_top (void) EXTERNALLY_VISIBLE;
136struct specbinding *backtrace_next (struct specbinding *pdl) EXTERNALLY_VISIBLE; 217union specbinding *backtrace_next (union specbinding *pdl) EXTERNALLY_VISIBLE;
137 218
138bool backtrace_p (struct specbinding *pdl) 219bool
220backtrace_p (union specbinding *pdl)
139{ return pdl >= specpdl; } 221{ return pdl >= specpdl; }
140 222
141struct specbinding * 223union specbinding *
142backtrace_top (void) 224backtrace_top (void)
143{ 225{
144 struct specbinding *pdl = specpdl_ptr - 1; 226 union specbinding *pdl = specpdl_ptr - 1;
145 while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) 227 while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE)
146 pdl--; 228 pdl--;
147 return pdl; 229 return pdl;
148} 230}
149 231
150struct specbinding * 232union specbinding *
151backtrace_next (struct specbinding *pdl) 233backtrace_next (union specbinding *pdl)
152{ 234{
153 pdl--; 235 pdl--;
154 while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) 236 while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE)
@@ -161,9 +243,9 @@ void
161init_eval_once (void) 243init_eval_once (void)
162{ 244{
163 enum { size = 50 }; 245 enum { size = 50 };
164 specpdl = xmalloc (size * sizeof *specpdl); 246 union specbinding *pdlvec = xmalloc ((size + 1) * sizeof *specpdl);
165 specpdl_size = size; 247 specpdl_size = size;
166 specpdl_ptr = specpdl; 248 specpdl = specpdl_ptr = pdlvec + 1;
167 /* Don't forget to update docs (lispref node "Local Variables"). */ 249 /* Don't forget to update docs (lispref node "Local Variables"). */
168 max_specpdl_size = 1300; /* 1000 is not enough for CEDET's c-by.el. */ 250 max_specpdl_size = 1300; /* 1000 is not enough for CEDET's c-by.el. */
169 max_lisp_eval_depth = 600; 251 max_lisp_eval_depth = 600;
@@ -565,7 +647,7 @@ The return value is BASE-VARIABLE. */)
565 set_internal (base_variable, find_symbol_value (new_alias), Qnil, 1); 647 set_internal (base_variable, find_symbol_value (new_alias), Qnil, 1);
566 648
567 { 649 {
568 struct specbinding *p; 650 union specbinding *p;
569 651
570 for (p = specpdl_ptr; p > specpdl; ) 652 for (p = specpdl_ptr; p > specpdl; )
571 if ((--p)->kind >= SPECPDL_LET 653 if ((--p)->kind >= SPECPDL_LET
@@ -631,7 +713,7 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
631 else 713 else
632 { /* Check if there is really a global binding rather than just a let 714 { /* Check if there is really a global binding rather than just a let
633 binding that shadows the global unboundness of the var. */ 715 binding that shadows the global unboundness of the var. */
634 struct specbinding *pdl = specpdl_ptr; 716 union specbinding *pdl = specpdl_ptr;
635 while (pdl > specpdl) 717 while (pdl > specpdl)
636 { 718 {
637 if ((--pdl)->kind >= SPECPDL_LET 719 if ((--pdl)->kind >= SPECPDL_LET
@@ -1430,7 +1512,7 @@ See also the function `condition-case'. */)
1430 Vsignaling_function = Qnil; 1512 Vsignaling_function = Qnil;
1431 if (!NILP (error_symbol)) 1513 if (!NILP (error_symbol))
1432 { 1514 {
1433 struct specbinding *pdl = backtrace_next (backtrace_top ()); 1515 union specbinding *pdl = backtrace_next (backtrace_top ());
1434 if (backtrace_p (pdl) && EQ (backtrace_function (pdl), Qerror)) 1516 if (backtrace_p (pdl) && EQ (backtrace_function (pdl), Qerror))
1435 pdl = backtrace_next (pdl); 1517 pdl = backtrace_next (pdl);
1436 if (backtrace_p (pdl)) 1518 if (backtrace_p (pdl))
@@ -1934,8 +2016,10 @@ If LEXICAL is t, evaluate using lexical scoping. */)
1934static void 2016static void
1935grow_specpdl (void) 2017grow_specpdl (void)
1936{ 2018{
1937 register ptrdiff_t count = SPECPDL_INDEX (); 2019 ptrdiff_t count = SPECPDL_INDEX ();
1938 ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX); 2020 ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX - 1000);
2021 union specbinding *pdlvec = specpdl - 1;
2022 ptrdiff_t pdlvecsize = specpdl_size + 1;
1939 if (max_size <= specpdl_size) 2023 if (max_size <= specpdl_size)
1940 { 2024 {
1941 if (max_specpdl_size < 400) 2025 if (max_specpdl_size < 400)
@@ -1943,7 +2027,9 @@ grow_specpdl (void)
1943 if (max_size <= specpdl_size) 2027 if (max_size <= specpdl_size)
1944 signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil); 2028 signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil);
1945 } 2029 }
1946 specpdl = xpalloc (specpdl, &specpdl_size, 1, max_size, sizeof *specpdl); 2030 pdlvec = xpalloc (pdlvec, &pdlvecsize, 1, max_size + 1, sizeof *specpdl);
2031 specpdl = pdlvec + 1;
2032 specpdl_size = pdlvecsize - 1;
1947 specpdl_ptr = specpdl + count; 2033 specpdl_ptr = specpdl + count;
1948} 2034}
1949 2035
@@ -1953,11 +2039,11 @@ record_in_backtrace (Lisp_Object function, Lisp_Object *args, ptrdiff_t nargs)
1953 eassert (nargs >= UNEVALLED); 2039 eassert (nargs >= UNEVALLED);
1954 if (specpdl_ptr == specpdl + specpdl_size) 2040 if (specpdl_ptr == specpdl + specpdl_size)
1955 grow_specpdl (); 2041 grow_specpdl ();
1956 specpdl_ptr->kind = SPECPDL_BACKTRACE; 2042 specpdl_ptr->bt.kind = SPECPDL_BACKTRACE;
1957 specpdl_ptr->v.bt.function = function; 2043 specpdl_ptr->bt.debug_on_exit = false;
1958 specpdl_ptr->v.bt.args = args; 2044 specpdl_ptr->bt.function = function;
1959 specpdl_ptr->v.bt.nargs = nargs; 2045 specpdl_ptr->bt.args = args;
1960 specpdl_ptr->v.bt.debug_on_exit = false; 2046 specpdl_ptr->bt.nargs = nargs;
1961 specpdl_ptr++; 2047 specpdl_ptr++;
1962} 2048}
1963 2049
@@ -2994,7 +3080,7 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
2994bool 3080bool
2995let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol) 3081let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
2996{ 3082{
2997 struct specbinding *p; 3083 union specbinding *p;
2998 Lisp_Object buf = Fcurrent_buffer (); 3084 Lisp_Object buf = Fcurrent_buffer ();
2999 3085
3000 for (p = specpdl_ptr; p > specpdl; ) 3086 for (p = specpdl_ptr; p > specpdl; )
@@ -3013,7 +3099,7 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
3013bool 3099bool
3014let_shadows_global_binding_p (Lisp_Object symbol) 3100let_shadows_global_binding_p (Lisp_Object symbol)
3015{ 3101{
3016 struct specbinding *p; 3102 union specbinding *p;
3017 3103
3018 for (p = specpdl_ptr; p > specpdl; ) 3104 for (p = specpdl_ptr; p > specpdl; )
3019 if ((--p)->kind >= SPECPDL_LET && EQ (specpdl_symbol (p), symbol)) 3105 if ((--p)->kind >= SPECPDL_LET && EQ (specpdl_symbol (p), symbol))
@@ -3023,7 +3109,7 @@ let_shadows_global_binding_p (Lisp_Object symbol)
3023} 3109}
3024 3110
3025static Lisp_Object 3111static Lisp_Object
3026binding_symbol (struct specbinding *bind) 3112binding_symbol (union specbinding *bind)
3027{ 3113{
3028 if (!CONSP (specpdl_symbol (bind))) 3114 if (!CONSP (specpdl_symbol (bind)))
3029 return specpdl_symbol (bind); 3115 return specpdl_symbol (bind);
@@ -3031,7 +3117,7 @@ binding_symbol (struct specbinding *bind)
3031} 3117}
3032 3118
3033void 3119void
3034do_specbind (struct Lisp_Symbol *sym, struct specbinding *bind, 3120do_specbind (struct Lisp_Symbol *sym, union specbinding *bind,
3035 Lisp_Object value) 3121 Lisp_Object value)
3036{ 3122{
3037 switch (sym->redirect) 3123 switch (sym->redirect)
@@ -3101,10 +3187,10 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3101 case SYMBOL_PLAINVAL: 3187 case SYMBOL_PLAINVAL:
3102 /* The most common case is that of a non-constant symbol with a 3188 /* The most common case is that of a non-constant symbol with a
3103 trivial value. Make that as fast as we can. */ 3189 trivial value. Make that as fast as we can. */
3104 specpdl_ptr->kind = SPECPDL_LET; 3190 specpdl_ptr->let.kind = SPECPDL_LET;
3105 specpdl_ptr->v.let.symbol = symbol; 3191 specpdl_ptr->let.symbol = symbol;
3106 specpdl_ptr->v.let.old_value = SYMBOL_VAL (sym); 3192 specpdl_ptr->let.old_value = SYMBOL_VAL (sym);
3107 specpdl_ptr->v.let.saved_value = Qnil; 3193 specpdl_ptr->let.saved_value = Qnil;
3108 ++specpdl_ptr; 3194 ++specpdl_ptr;
3109 do_specbind (sym, specpdl_ptr - 1, value); 3195 do_specbind (sym, specpdl_ptr - 1, value);
3110 break; 3196 break;
@@ -3114,11 +3200,11 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3114 case SYMBOL_FORWARDED: 3200 case SYMBOL_FORWARDED:
3115 { 3201 {
3116 Lisp_Object ovalue = find_symbol_value (symbol); 3202 Lisp_Object ovalue = find_symbol_value (symbol);
3117 specpdl_ptr->kind = SPECPDL_LET_LOCAL; 3203 specpdl_ptr->let.kind = SPECPDL_LET_LOCAL;
3118 specpdl_ptr->v.let.symbol = symbol; 3204 specpdl_ptr->let.symbol = symbol;
3119 specpdl_ptr->v.let.old_value = ovalue; 3205 specpdl_ptr->let.old_value = ovalue;
3120 specpdl_ptr->v.let.where = Fcurrent_buffer (); 3206 specpdl_ptr->let.where = Fcurrent_buffer ();
3121 specpdl_ptr->v.let.saved_value = Qnil; 3207 specpdl_ptr->let.saved_value = Qnil;
3122 3208
3123 eassert (sym->redirect != SYMBOL_LOCALIZED 3209 eassert (sym->redirect != SYMBOL_LOCALIZED
3124 || (EQ (SYMBOL_BLV (sym)->where, Fcurrent_buffer ()))); 3210 || (EQ (SYMBOL_BLV (sym)->where, Fcurrent_buffer ())));
@@ -3126,7 +3212,7 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3126 if (sym->redirect == SYMBOL_LOCALIZED) 3212 if (sym->redirect == SYMBOL_LOCALIZED)
3127 { 3213 {
3128 if (!blv_found (SYMBOL_BLV (sym))) 3214 if (!blv_found (SYMBOL_BLV (sym)))
3129 specpdl_ptr->kind = SPECPDL_LET_DEFAULT; 3215 specpdl_ptr->let.kind = SPECPDL_LET_DEFAULT;
3130 } 3216 }
3131 else if (BUFFER_OBJFWDP (SYMBOL_FWD (sym))) 3217 else if (BUFFER_OBJFWDP (SYMBOL_FWD (sym)))
3132 { 3218 {
@@ -3137,14 +3223,14 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3137 happens with other buffer-local variables. */ 3223 happens with other buffer-local variables. */
3138 if (NILP (Flocal_variable_p (symbol, Qnil))) 3224 if (NILP (Flocal_variable_p (symbol, Qnil)))
3139 { 3225 {
3140 specpdl_ptr->kind = SPECPDL_LET_DEFAULT; 3226 specpdl_ptr->let.kind = SPECPDL_LET_DEFAULT;
3141 ++specpdl_ptr; 3227 ++specpdl_ptr;
3142 do_specbind (sym, specpdl_ptr - 1, value); 3228 do_specbind (sym, specpdl_ptr - 1, value);
3143 return; 3229 return;
3144 } 3230 }
3145 } 3231 }
3146 else 3232 else
3147 specpdl_ptr->kind = SPECPDL_LET; 3233 specpdl_ptr->let.kind = SPECPDL_LET;
3148 3234
3149 specpdl_ptr++; 3235 specpdl_ptr++;
3150 do_specbind (sym, specpdl_ptr - 1, value); 3236 do_specbind (sym, specpdl_ptr - 1, value);
@@ -3159,16 +3245,16 @@ record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg)
3159{ 3245{
3160 if (specpdl_ptr == specpdl + specpdl_size) 3246 if (specpdl_ptr == specpdl + specpdl_size)
3161 grow_specpdl (); 3247 grow_specpdl ();
3162 specpdl_ptr->kind = SPECPDL_UNWIND; 3248 specpdl_ptr->unwind.kind = SPECPDL_UNWIND;
3163 specpdl_ptr->v.unwind.func = function; 3249 specpdl_ptr->unwind.func = function;
3164 specpdl_ptr->v.unwind.arg = arg; 3250 specpdl_ptr->unwind.arg = arg;
3165 specpdl_ptr++; 3251 specpdl_ptr++;
3166} 3252}
3167 3253
3168void 3254void
3169rebind_for_thread_switch (void) 3255rebind_for_thread_switch (void)
3170{ 3256{
3171 struct specbinding *bind; 3257 union specbinding *bind;
3172 3258
3173 for (bind = specpdl; bind != specpdl_ptr; ++bind) 3259 for (bind = specpdl; bind != specpdl_ptr; ++bind)
3174 { 3260 {
@@ -3176,20 +3262,20 @@ rebind_for_thread_switch (void)
3176 { 3262 {
3177 Lisp_Object value = specpdl_saved_value (bind); 3263 Lisp_Object value = specpdl_saved_value (bind);
3178 3264
3179 bind->v.let.saved_value = Qnil; 3265 bind->let.saved_value = Qnil;
3180 do_specbind (XSYMBOL (binding_symbol (bind)), bind, value); 3266 do_specbind (XSYMBOL (binding_symbol (bind)), bind, value);
3181 } 3267 }
3182 } 3268 }
3183} 3269}
3184 3270
3185static void 3271static void
3186do_one_unbind (struct specbinding *this_binding, int unwinding) 3272do_one_unbind (union specbinding *this_binding, int unwinding)
3187{ 3273{
3188 eassert (unwinding || this_binding->kind >= SPECPDL_LET); 3274 eassert (unwinding || this_binding->kind >= SPECPDL_LET);
3189 switch (this_binding->kind) 3275 switch (this_binding->kind)
3190 { 3276 {
3191 case SPECPDL_UNWIND: 3277 case SPECPDL_UNWIND:
3192 (*specpdl_func (this_binding)) (specpdl_arg (this_binding)); 3278 specpdl_func (this_binding) (specpdl_arg (this_binding));
3193 break; 3279 break;
3194 case SPECPDL_LET: 3280 case SPECPDL_LET:
3195 /* If variable has a trivial value (no forwarding), we can 3281 /* If variable has a trivial value (no forwarding), we can
@@ -3249,7 +3335,7 @@ unbind_to (ptrdiff_t count, Lisp_Object value)
3249 the same entry again, and we copy the binding first 3335 the same entry again, and we copy the binding first
3250 in case more bindings are made during some of the code we run. */ 3336 in case more bindings are made during some of the code we run. */
3251 3337
3252 struct specbinding this_binding; 3338 union specbinding this_binding;
3253 this_binding = *--specpdl_ptr; 3339 this_binding = *--specpdl_ptr;
3254 3340
3255 do_one_unbind (&this_binding, 1); 3341 do_one_unbind (&this_binding, 1);
@@ -3265,13 +3351,13 @@ unbind_to (ptrdiff_t count, Lisp_Object value)
3265void 3351void
3266unbind_for_thread_switch (void) 3352unbind_for_thread_switch (void)
3267{ 3353{
3268 struct specbinding *bind; 3354 union specbinding *bind;
3269 3355
3270 for (bind = specpdl_ptr; bind != specpdl; --bind) 3356 for (bind = specpdl_ptr; bind != specpdl; --bind)
3271 { 3357 {
3272 if (bind->kind >= SPECPDL_LET) 3358 if (bind->kind >= SPECPDL_LET)
3273 { 3359 {
3274 bind->v.let.saved_value = find_symbol_value (binding_symbol (bind)); 3360 bind->let.saved_value = find_symbol_value (binding_symbol (bind));
3275 do_one_unbind (bind, 0); 3361 do_one_unbind (bind, 0);
3276 } 3362 }
3277 } 3363 }
@@ -3293,7 +3379,7 @@ DEFUN ("backtrace-debug", Fbacktrace_debug, Sbacktrace_debug, 2, 2, 0,
3293The debugger is entered when that frame exits, if the flag is non-nil. */) 3379The debugger is entered when that frame exits, if the flag is non-nil. */)
3294 (Lisp_Object level, Lisp_Object flag) 3380 (Lisp_Object level, Lisp_Object flag)
3295{ 3381{
3296 struct specbinding *pdl = backtrace_top (); 3382 union specbinding *pdl = backtrace_top ();
3297 register EMACS_INT i; 3383 register EMACS_INT i;
3298 3384
3299 CHECK_NUMBER (level); 3385 CHECK_NUMBER (level);
@@ -3312,7 +3398,7 @@ DEFUN ("backtrace", Fbacktrace, Sbacktrace, 0, 0, "",
3312Output stream used is value of `standard-output'. */) 3398Output stream used is value of `standard-output'. */)
3313 (void) 3399 (void)
3314{ 3400{
3315 struct specbinding *pdl = backtrace_top (); 3401 union specbinding *pdl = backtrace_top ();
3316 Lisp_Object tem; 3402 Lisp_Object tem;
3317 Lisp_Object old_print_level = Vprint_level; 3403 Lisp_Object old_print_level = Vprint_level;
3318 3404
@@ -3362,7 +3448,7 @@ or a lambda expression for macro calls.
3362If NFRAMES is more than the number of frames, the value is nil. */) 3448If NFRAMES is more than the number of frames, the value is nil. */)
3363 (Lisp_Object nframes) 3449 (Lisp_Object nframes)
3364{ 3450{
3365 struct specbinding *pdl = backtrace_top (); 3451 union specbinding *pdl = backtrace_top ();
3366 register EMACS_INT i; 3452 register EMACS_INT i;
3367 3453
3368 CHECK_NATNUM (nframes); 3454 CHECK_NATNUM (nframes);
@@ -3386,9 +3472,9 @@ If NFRAMES is more than the number of frames, the value is nil. */)
3386 3472
3387 3473
3388void 3474void
3389mark_specpdl (struct specbinding *first, struct specbinding *ptr) 3475mark_specpdl (union specbinding *first, union specbinding *ptr)
3390{ 3476{
3391 struct specbinding *pdl; 3477 union specbinding *pdl;
3392 for (pdl = first; pdl != ptr; pdl++) 3478 for (pdl = first; pdl != ptr; pdl++)
3393 { 3479 {
3394 switch (pdl->kind) 3480 switch (pdl->kind)
@@ -3396,6 +3482,7 @@ mark_specpdl (struct specbinding *first, struct specbinding *ptr)
3396 case SPECPDL_UNWIND: 3482 case SPECPDL_UNWIND:
3397 mark_object (specpdl_arg (pdl)); 3483 mark_object (specpdl_arg (pdl));
3398 break; 3484 break;
3485
3399 case SPECPDL_BACKTRACE: 3486 case SPECPDL_BACKTRACE:
3400 { 3487 {
3401 ptrdiff_t nargs = backtrace_nargs (pdl); 3488 ptrdiff_t nargs = backtrace_nargs (pdl);
@@ -3406,13 +3493,16 @@ mark_specpdl (struct specbinding *first, struct specbinding *ptr)
3406 mark_object (backtrace_args (pdl)[nargs]); 3493 mark_object (backtrace_args (pdl)[nargs]);
3407 } 3494 }
3408 break; 3495 break;
3496
3409 case SPECPDL_LET_DEFAULT: 3497 case SPECPDL_LET_DEFAULT:
3410 case SPECPDL_LET_LOCAL: 3498 case SPECPDL_LET_LOCAL:
3411 mark_object (specpdl_where (pdl)); 3499 mark_object (specpdl_where (pdl));
3500 /* Fall through. */
3412 case SPECPDL_LET: 3501 case SPECPDL_LET:
3413 mark_object (specpdl_symbol (pdl)); 3502 mark_object (specpdl_symbol (pdl));
3414 mark_object (specpdl_old_value (pdl)); 3503 mark_object (specpdl_old_value (pdl));
3415 mark_object (specpdl_saved_value (pdl)); 3504 mark_object (specpdl_saved_value (pdl));
3505 break;
3416 } 3506 }
3417 } 3507 }
3418} 3508}
@@ -3420,7 +3510,7 @@ mark_specpdl (struct specbinding *first, struct specbinding *ptr)
3420void 3510void
3421get_backtrace (Lisp_Object array) 3511get_backtrace (Lisp_Object array)
3422{ 3512{
3423 struct specbinding *pdl = backtrace_next (backtrace_top ()); 3513 union specbinding *pdl = backtrace_next (backtrace_top ());
3424 ptrdiff_t i = 0, asize = ASIZE (array); 3514 ptrdiff_t i = 0, asize = ASIZE (array);
3425 3515
3426 /* Copy the backtrace contents into working memory. */ 3516 /* Copy the backtrace contents into working memory. */
@@ -3438,7 +3528,7 @@ get_backtrace (Lisp_Object array)
3438 3528
3439Lisp_Object backtrace_top_function (void) 3529Lisp_Object backtrace_top_function (void)
3440{ 3530{
3441 struct specbinding *pdl = backtrace_top (); 3531 union specbinding *pdl = backtrace_top ();
3442 return (backtrace_p (pdl) ? backtrace_function (pdl) : Qnil); 3532 return (backtrace_p (pdl) ? backtrace_function (pdl) : Qnil);
3443} 3533}
3444 3534