diff options
| author | Stefan Monnier | 2013-06-03 05:01:53 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2013-06-03 05:01:53 -0400 |
| commit | 2f592f95d2344d4a28eb946848330dca49e0f5ee (patch) | |
| tree | a920b413f4367d49b7f7feeb3fdf63c5e9018dcb /src/alloc.c | |
| parent | e5e4a94293d5a9a157557e53b4fea4e5d280673e (diff) | |
| download | emacs-2f592f95d2344d4a28eb946848330dca49e0f5ee.tar.gz emacs-2f592f95d2344d4a28eb946848330dca49e0f5ee.zip | |
Merge the specpdl and backtrace stacks. Make the structure of the
specpdl entries more obvious via a tagged union of structs.
* src/lisp.h (BITS_PER_PTRDIFF_T): New constant.
(enum specbind_tag): New enum.
(struct specbinding): Make it a tagged union of structs.
Add a case for backtrace records.
(specpdl_symbol, specpdl_old_value, specpdl_where, specpdl_arg)
(specpdl_func, backtrace_function, backtrace_nargs, backtrace_args)
(backtrace_debug_on_exit): New accessors.
(struct backtrace): Remove.
(struct catchtag): Remove backlist field.
* src/data.c (let_shadows_buffer_binding_p, let_shadows_global_binding_p):
Move to eval.c.
(Flocal_variable_p): Speed up the common case where the binding is
already loaded.
* src/eval.c (backtrace_list): Remove.
(set_specpdl_symbol, set_specpdl_old_value): Remove.
(set_backtrace_args, set_backtrace_nargs)
(set_backtrace_debug_on_exit, backtrace_p, backtrace_top)
(backtrace_next): New functions.
(Fdefvaralias, Fdefvar): Adjust to new specpdl format.
(unwind_to_catch, internal_lisp_condition_case)
(internal_condition_case, internal_condition_case_1)
(internal_condition_case_2, internal_condition_case_n): Don't bother
with backtrace_list any more.
(Fsignal): Adjust to new backtrace format.
(grow_specpdl): Move up.
(record_in_backtrace): New function.
(eval_sub, Ffuncall): Use it.
(apply_lambda): Adjust to new backtrace format.
(let_shadows_buffer_binding_p, let_shadows_global_binding_p): Move from
data.c.
(specbind): Adjust to new specpdl format. Simplify.
(record_unwind_protect, unbind_to): Adjust to new specpdl format.
(Fbacktrace_debug, Fbacktrace, Fbacktrace_frame): Adjust to new
backtrace format.
(mark_backtrace): Remove.
(mark_specpdl, get_backtrace, backtrace_top_function): New functions.
* src/xdisp.c (redisplay_internal): Use record_in_backtrace.
* src/alloc.c (Fgarbage_collect): Use record_in_backtrace.
Use mark_specpdl.
* src/profiler.c (record_backtrace): Use get_backtrace.
(handle_profiler_signal): Use backtrace_top_function.
* src/.gdbinit (xbacktrace, hookpost-backtrace): Use new backtrace
accessor functions.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/alloc.c b/src/alloc.c index 7a56c78e2ba..cce0fff4fd4 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -5165,7 +5165,6 @@ returns nil, because real GC can't be done. | |||
| 5165 | See Info node `(elisp)Garbage Collection'. */) | 5165 | See Info node `(elisp)Garbage Collection'. */) |
| 5166 | (void) | 5166 | (void) |
| 5167 | { | 5167 | { |
| 5168 | struct specbinding *bind; | ||
| 5169 | struct buffer *nextb; | 5168 | struct buffer *nextb; |
| 5170 | char stack_top_variable; | 5169 | char stack_top_variable; |
| 5171 | ptrdiff_t i; | 5170 | ptrdiff_t i; |
| @@ -5174,7 +5173,6 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5174 | EMACS_TIME start; | 5173 | EMACS_TIME start; |
| 5175 | Lisp_Object retval = Qnil; | 5174 | Lisp_Object retval = Qnil; |
| 5176 | size_t tot_before = 0; | 5175 | size_t tot_before = 0; |
| 5177 | struct backtrace backtrace; | ||
| 5178 | 5176 | ||
| 5179 | if (abort_on_gc) | 5177 | if (abort_on_gc) |
| 5180 | emacs_abort (); | 5178 | emacs_abort (); |
| @@ -5185,12 +5183,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5185 | return Qnil; | 5183 | return Qnil; |
| 5186 | 5184 | ||
| 5187 | /* Record this function, so it appears on the profiler's backtraces. */ | 5185 | /* Record this function, so it appears on the profiler's backtraces. */ |
| 5188 | backtrace.next = backtrace_list; | 5186 | record_in_backtrace (Qautomatic_gc, &Qnil, 0); |
| 5189 | backtrace.function = Qautomatic_gc; | ||
| 5190 | backtrace.args = &Qnil; | ||
| 5191 | backtrace.nargs = 0; | ||
| 5192 | backtrace.debug_on_exit = 0; | ||
| 5193 | backtrace_list = &backtrace; | ||
| 5194 | 5187 | ||
| 5195 | check_cons_list (); | 5188 | check_cons_list (); |
| 5196 | 5189 | ||
| @@ -5257,11 +5250,7 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5257 | for (i = 0; i < staticidx; i++) | 5250 | for (i = 0; i < staticidx; i++) |
| 5258 | mark_object (*staticvec[i]); | 5251 | mark_object (*staticvec[i]); |
| 5259 | 5252 | ||
| 5260 | for (bind = specpdl; bind != specpdl_ptr; bind++) | 5253 | mark_specpdl (); |
| 5261 | { | ||
| 5262 | mark_object (bind->symbol); | ||
| 5263 | mark_object (bind->old_value); | ||
| 5264 | } | ||
| 5265 | mark_terminals (); | 5254 | mark_terminals (); |
| 5266 | mark_kboards (); | 5255 | mark_kboards (); |
| 5267 | 5256 | ||
| @@ -5295,7 +5284,6 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5295 | mark_object (handler->var); | 5284 | mark_object (handler->var); |
| 5296 | } | 5285 | } |
| 5297 | } | 5286 | } |
| 5298 | mark_backtrace (); | ||
| 5299 | #endif | 5287 | #endif |
| 5300 | 5288 | ||
| 5301 | #ifdef HAVE_WINDOW_SYSTEM | 5289 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -5486,7 +5474,6 @@ See Info node `(elisp)Garbage Collection'. */) | |||
| 5486 | malloc_probe (swept); | 5474 | malloc_probe (swept); |
| 5487 | } | 5475 | } |
| 5488 | 5476 | ||
| 5489 | backtrace_list = backtrace.next; | ||
| 5490 | return retval; | 5477 | return retval; |
| 5491 | } | 5478 | } |
| 5492 | 5479 | ||