Mercurial > hg > xemacs-beta
annotate src/profile.h @ 5581:56144c8593a8
Mechanically change INT to FIXNUM in our sources.
src/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT (where it refers to non-bignum Lisp
integers) to FIXNUM in our sources. Done for the following
functions, enums, and macros: Lisp_Type_Int_Even,
Lisp_Type_Int_Odd, INT_GCBITS, INT_VALBITS, make_int(), INTP(),
XINT(), CHECK_INT(), XREALINT(), INT_PLUS(), INT_MINUS(),
EMACS_INT_MAX (to MOST_POSITIVE_FIXNUM), EMACS_INT_MIN (to
MOST_NEGATIVE_FIXNUM), NUMBER_FITS_IN_AN_EMACS_INT() to
NUMBER_FITS_IN_A_FIXNUM(), XFLOATINT, XCHAR_OR_INT, INT_OR_FLOAT.
The EMACS_INT typedef was not changed, it does not describe
non-bignum Lisp integers.
Script that did the change available in
http://mid.gmane.org/20067.17650.181273.12014@parhasard.net .
modules/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
[...]
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers. See the src/ChangeLog entry for more details.
man/ChangeLog addition:
2011-10-09 Aidan Kehoe <kehoea@parhasard.net>
* internals/internals.texi (How Lisp Objects Are Represented in C):
* internals/internals.texi (Integers and Characters):
Mechanically change INT to FIXNUM, where the usage describes non-bignum
Lisp integers.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 09 Oct 2011 09:51:57 +0100 |
parents | 308d34e9f07d |
children |
rev | line source |
---|---|
1292 | 1 /* Profiling. |
3025 | 2 Copyright (C) 2003, 2005 Ben Wing. |
1292 | 3 |
4 This file is part of XEmacs. | |
5 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4162
diff
changeset
|
6 XEmacs is free software: you can redistribute it and/or modify it |
1292 | 7 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4162
diff
changeset
|
8 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4162
diff
changeset
|
9 option) any later version. |
1292 | 10 |
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4162
diff
changeset
|
17 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
1292 | 18 |
19 /* Synched up with: Not in FSF. */ | |
20 | |
21 /* Authorship: | |
22 | |
23 Ben Wing: Feb 2003. | |
24 */ | |
25 | |
26 #include "backtrace.h" | |
27 | |
28 void mark_profiling_info (void); | |
29 void profile_record_unwind (struct backtrace *); | |
30 void profile_record_about_to_call (struct backtrace *); | |
31 void profile_record_just_called (struct backtrace *); | |
32 void profile_record_consing (EMACS_INT size); | |
33 void profile_record_unconsing (EMACS_INT size); | |
34 extern int profiling_active; | |
35 | |
36 /* We call about_to_call() and just_called() depending on the current | |
37 *dynamic* value of profiling_active (which could change as a result of | |
38 calling the function) but if we push a backtrace, we must pop it later, | |
39 so we need to remember the status of this. */ | |
40 #define PROFILE_DECLARE() \ | |
41 int do_backtrace = profiling_active || backtrace_with_internal_sections; \ | |
42 struct backtrace backtrace | |
43 | |
44 /* As just mentioned, we rely on the dynamic value of profiling_active. | |
45 This ensures correct behavior (e.g. we never modify the profiling info | |
46 when profiling is not active) because we seed and reap all functions | |
47 currently on the stack when starting and stopping. See | |
4162 | 48 `start-profiling'. |
49 | |
50 We check do_backtrace to make sure that the backtrace structure is | |
51 initialised. If it isn't, we can enter a function with profiling turned | |
52 off, and exit it with it turned on, with the consequence that an | |
53 unitialised backtrace structure is passed to | |
54 profile_record_just_called. Since do_backtrace is function-local (apart | |
55 from in the garbage collector) this avoids that. */ | |
1292 | 56 #define PROFILE_ENTER_FUNCTION() \ |
57 do \ | |
58 { \ | |
4162 | 59 if (profiling_active && do_backtrace) \ |
1292 | 60 profile_record_about_to_call (&backtrace); \ |
61 } \ | |
62 while (0) | |
63 | |
64 #define PROFILE_EXIT_FUNCTION() \ | |
65 do \ | |
66 { \ | |
4162 | 67 if (profiling_active && do_backtrace) \ |
1292 | 68 profile_record_just_called (&backtrace); \ |
69 } \ | |
70 while (0) | |
71 | |
72 /* We are entering a section that we would like to record profile information | |
73 about. We put this information into the backtrace list, just like | |
74 normal functions do. That is one easy way to make sure that we always | |
75 record info on the innermost section or function, whether section or | |
76 function. (To do this, we always need some sort of collusion between | |
77 profile and eval; this is one way.) */ | |
78 | |
3025 | 79 /* Or, we could call xzero() to zero the whole thing, and avoid four |
80 of the statements below; or we could create a global backtrace object, | |
81 uninitialized (i.e. it will be initialized to all 0), and do structure | |
82 copy to initialize. It's not clear it will make much difference here, | |
83 but someone who really cared about counting cycles could implement it. */ | |
1292 | 84 #define PROFILE_RECORD_ENTERING_SECTION(var) \ |
85 do \ | |
86 { \ | |
87 if (do_backtrace) \ | |
88 { \ | |
89 backtrace.function = &var; \ | |
90 backtrace.args = NULL; \ | |
91 backtrace.nargs = UNEVALLED; \ | |
92 backtrace.evalargs = 0; \ | |
93 backtrace.pdlcount = specpdl_depth (); \ | |
94 backtrace.debug_on_exit = 0; \ | |
95 backtrace.function_being_called = 0; \ | |
96 PUSH_BACKTRACE (backtrace); \ | |
97 } \ | |
98 PROFILE_ENTER_FUNCTION (); \ | |
99 } while (0) | |
100 | |
101 #define PROFILE_RECORD_EXITING_SECTION(var) \ | |
102 do \ | |
103 { \ | |
104 PROFILE_EXIT_FUNCTION (); \ | |
105 if (do_backtrace) \ | |
106 POP_BACKTRACE (backtrace); \ | |
107 } while (0) | |
2514 | 108 |
109 #define RETURN_EXIT_PROFILING(tag, type, expr) \ | |
110 do \ | |
111 { \ | |
112 type _ret_exitpr_ = (expr); \ | |
113 PROFILE_RECORD_EXITING_SECTION (tag); \ | |
114 RETURN_SANS_WARNINGS _ret_exitpr_; \ | |
115 } while (0) | |
116 | |
117 #define RETURN_LISP_EXIT_PROFILING(tag, expr) \ | |
118 RETURN_EXIT_PROFILING (tag, Lisp_Object, expr) | |
119 | |
120 #define RETURN_UNGCPRO_EXIT_PROFILING(tag, expr) \ | |
3282 | 121 do \ |
2514 | 122 { \ |
123 Lisp_Object ret_ungc_val = (expr); \ | |
124 UNGCPRO; \ | |
125 PROFILE_RECORD_EXITING_SECTION (tag); \ | |
126 RETURN_SANS_WARNINGS ret_ungc_val; \ | |
127 } while (0) | |
128 | |
129 #ifdef DEBUG_XEMACS | |
130 extern Lisp_Object QSin_temp_spot_1; | |
131 extern Lisp_Object QSin_temp_spot_2; | |
132 extern Lisp_Object QSin_temp_spot_3; | |
133 extern Lisp_Object QSin_temp_spot_4; | |
134 extern Lisp_Object QSin_temp_spot_5; | |
135 #endif /* DEBUG_XEMACS */ |