Mercurial > hg > xemacs-beta
diff src/eval.c @ 116:9f59509498e1 r20-1b10
Import from CVS: tag r20-1b10
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:23:06 +0200 |
parents | 1040fe1366ac |
children | 538048ae2ab8 |
line wrap: on
line diff
--- a/src/eval.c Mon Aug 13 09:21:56 2007 +0200 +++ b/src/eval.c Mon Aug 13 09:23:06 2007 +0200 @@ -41,6 +41,16 @@ struct backtrace *backtrace_list; +/* Note you must always fill all of the fields in a backtrace structure + before pushing them on the backtrace_list. The profiling code depends + on this. */ + +#define PUSH_BACKTRACE(bt) \ + do { (bt).next = backtrace_list; backtrace_list = &(bt); } while (0) + +#define POP_BACKTRACE(bt) \ + do { backtrace_list = (bt).next; } while (0) + /* This is the list of current catches (and also condition-cases). This is a stack: the most recent catch is at the head of the list. Catches are created by declaring a 'struct catchtag' @@ -2582,18 +2592,17 @@ #ifdef EMACS_BTL backtrace.id_number = 0; #endif - backtrace.next = backtrace_list; - backtrace_list = &backtrace; backtrace.function = &Qcall_interactively; backtrace.args = &cmd; backtrace.nargs = 1; backtrace.evalargs = 0; backtrace.pdlcount = specpdl_depth (); backtrace.debug_on_exit = 0; + PUSH_BACKTRACE (backtrace); final = Fcall_interactively (cmd, record, keys); - backtrace_list = backtrace.next; + POP_BACKTRACE (backtrace); return (final); } else if (STRINGP (final) || VECTORP (final)) @@ -2917,13 +2926,12 @@ backtrace.id_number = 0; #endif backtrace.pdlcount = specpdl_depth_counter; - backtrace.next = backtrace_list; - backtrace_list = &backtrace; backtrace.function = &original_fun; /* This also protects them from gc */ backtrace.args = &original_args; backtrace.nargs = UNEVALLED; backtrace.evalargs = 1; backtrace.debug_on_exit = 0; + PUSH_BACKTRACE (backtrace); if (debug_on_next_call) do_debug_on_call (Qt); @@ -2999,7 +3007,7 @@ #endif if (backtrace.debug_on_exit) val = do_debug_on_exit (val); - backtrace_list = backtrace.next; + POP_BACKTRACE (backtrace); UNGCPRO; return (val); } @@ -3072,7 +3080,7 @@ #endif if (backtrace.debug_on_exit) val = do_debug_on_exit (val); - backtrace_list = backtrace.next; + POP_BACKTRACE (backtrace); return (val); } @@ -3107,15 +3115,12 @@ backtrace.id_number = 0; #endif backtrace.pdlcount = specpdl_depth_counter; - backtrace.next = backtrace_list; backtrace.function = &args[0]; backtrace.args = &args[1]; backtrace.nargs = nargs; backtrace.evalargs = 0; backtrace.debug_on_exit = 0; - /* XEmacs: make sure this is done last so we don't get race - conditions in the profiling code. */ - backtrace_list = &backtrace; + PUSH_BACKTRACE (backtrace); if (debug_on_next_call) do_debug_on_call (Qlambda); @@ -3204,7 +3209,7 @@ lisp_eval_depth--; if (backtrace.debug_on_exit) val = do_debug_on_exit (val); - backtrace_list = backtrace.next; + POP_BACKTRACE (backtrace); return val; }