Mercurial > hg > xemacs-beta
diff src/profile.h @ 5118:e0db3c197671 ben-lisp-object
merge up to latest default branch, doesn't compile yet
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 26 Dec 2009 21:18:49 -0600 |
parents | 8f6a825eb3d3 |
children | 308d34e9f07d |
line wrap: on
line diff
--- a/src/profile.h Sat Dec 26 00:20:27 2009 -0600 +++ b/src/profile.h Sat Dec 26 21:18:49 2009 -0600 @@ -47,11 +47,18 @@ This ensures correct behavior (e.g. we never modify the profiling info when profiling is not active) because we seed and reap all functions currently on the stack when starting and stopping. See - `start-profiling'. */ + `start-profiling'. + + We check do_backtrace to make sure that the backtrace structure is + initialised. If it isn't, we can enter a function with profiling turned + off, and exit it with it turned on, with the consequence that an + unitialised backtrace structure is passed to + profile_record_just_called. Since do_backtrace is function-local (apart + from in the garbage collector) this avoids that. */ #define PROFILE_ENTER_FUNCTION() \ do \ { \ - if (profiling_active) \ + if (profiling_active && do_backtrace) \ profile_record_about_to_call (&backtrace); \ } \ while (0) @@ -59,7 +66,7 @@ #define PROFILE_EXIT_FUNCTION() \ do \ { \ - if (profiling_active) \ + if (profiling_active && do_backtrace) \ profile_record_just_called (&backtrace); \ } \ while (0) @@ -113,6 +120,7 @@ RETURN_EXIT_PROFILING (tag, Lisp_Object, expr) #define RETURN_UNGCPRO_EXIT_PROFILING(tag, expr) \ +do \ { \ Lisp_Object ret_ungc_val = (expr); \ UNGCPRO; \