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/data.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/data.c')
| -rw-r--r-- | src/data.c | 57 |
1 files changed, 12 insertions, 45 deletions
diff --git a/src/data.c b/src/data.c index 6622088b648..b33d9656d57 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -1069,40 +1069,6 @@ DEFUN ("set", Fset, Sset, 2, 2, 0, | |||
| 1069 | return newval; | 1069 | return newval; |
| 1070 | } | 1070 | } |
| 1071 | 1071 | ||
| 1072 | /* Return true if SYMBOL currently has a let-binding | ||
| 1073 | which was made in the buffer that is now current. */ | ||
| 1074 | |||
| 1075 | static bool | ||
| 1076 | let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol) | ||
| 1077 | { | ||
| 1078 | struct specbinding *p; | ||
| 1079 | |||
| 1080 | for (p = specpdl_ptr; p > specpdl; ) | ||
| 1081 | if ((--p)->func == NULL | ||
| 1082 | && CONSP (p->symbol)) | ||
| 1083 | { | ||
| 1084 | struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol)); | ||
| 1085 | eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS); | ||
| 1086 | if (symbol == let_bound_symbol | ||
| 1087 | && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) | ||
| 1088 | return 1; | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | return 0; | ||
| 1092 | } | ||
| 1093 | |||
| 1094 | static bool | ||
| 1095 | let_shadows_global_binding_p (Lisp_Object symbol) | ||
| 1096 | { | ||
| 1097 | struct specbinding *p; | ||
| 1098 | |||
| 1099 | for (p = specpdl_ptr; p > specpdl; ) | ||
| 1100 | if ((--p)->func == NULL && EQ (p->symbol, symbol)) | ||
| 1101 | return 1; | ||
| 1102 | |||
| 1103 | return 0; | ||
| 1104 | } | ||
| 1105 | |||
| 1106 | /* Store the value NEWVAL into SYMBOL. | 1072 | /* Store the value NEWVAL into SYMBOL. |
| 1107 | If buffer/frame-locality is an issue, WHERE specifies which context to use. | 1073 | If buffer/frame-locality is an issue, WHERE specifies which context to use. |
| 1108 | (nil stands for the current buffer/frame). | 1074 | (nil stands for the current buffer/frame). |
| @@ -1841,17 +1807,18 @@ BUFFER defaults to the current buffer. */) | |||
| 1841 | XSETBUFFER (tmp, buf); | 1807 | XSETBUFFER (tmp, buf); |
| 1842 | XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ | 1808 | XSETSYMBOL (variable, sym); /* Update in case of aliasing. */ |
| 1843 | 1809 | ||
| 1844 | for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) | 1810 | if (EQ (blv->where, tmp)) /* The binding is already loaded. */ |
| 1845 | { | 1811 | return blv_found (blv) ? Qt : Qnil; |
| 1846 | elt = XCAR (tail); | 1812 | else |
| 1847 | if (EQ (variable, XCAR (elt))) | 1813 | for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail)) |
| 1848 | { | 1814 | { |
| 1849 | eassert (!blv->frame_local); | 1815 | elt = XCAR (tail); |
| 1850 | eassert (blv_found (blv) || !EQ (blv->where, tmp)); | 1816 | if (EQ (variable, XCAR (elt))) |
| 1851 | return Qt; | 1817 | { |
| 1852 | } | 1818 | eassert (!blv->frame_local); |
| 1853 | } | 1819 | return Qt; |
| 1854 | eassert (!blv_found (blv) || !EQ (blv->where, tmp)); | 1820 | } |
| 1821 | } | ||
| 1855 | return Qnil; | 1822 | return Qnil; |
| 1856 | } | 1823 | } |
| 1857 | case SYMBOL_FORWARDED: | 1824 | case SYMBOL_FORWARDED: |