This source file includes following definitions.
- pdumper_remember_scalar
- pdumper_remember_lv_ptr_raw
- pdumper_do_now_and_after_load
- pdumper_do_now_and_after_late_load
- pdumper_object_p
- pdumper_cold_object_p
- pdumper_find_object_type
- pdumper_valid_object_type_p
- pdumper_object_p_precise
- pdumper_marked_p
- pdumper_set_marked
- pdumper_clear_marks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #ifndef EMACS_PDUMPER_H
21 #define EMACS_PDUMPER_H
22
23 #include <stdio.h>
24 #include "fingerprint.h"
25 #include "lisp.h"
26
27 INLINE_HEADER_BEGIN
28
29 enum { PDUMPER_NO_OBJECT = -1 };
30
31
32
33
34 #define PDUMPER_IGNORE(thing) ((void) &(thing))
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 #define PDUMPER_REMEMBER_SCALAR(thing) \
53 pdumper_remember_scalar (&(thing), sizeof (thing))
54
55 extern void dump_fingerprint (FILE *output, const char *label,
56 unsigned char const fingerp[sizeof fingerprint]);
57
58 extern void pdumper_remember_scalar_impl (void *data, ptrdiff_t nbytes);
59
60 INLINE void
61 pdumper_remember_scalar (void *data, ptrdiff_t nbytes)
62 {
63 #ifdef HAVE_PDUMPER
64 pdumper_remember_scalar_impl (data, nbytes);
65 #else
66 (void) data;
67 (void) nbytes;
68 #endif
69 }
70
71 extern void pdumper_remember_lv_ptr_raw_impl (void *ptr, enum Lisp_Type type);
72
73
74
75
76 INLINE void
77 pdumper_remember_lv_ptr_raw (void *ptr, enum Lisp_Type type)
78 {
79 #ifdef HAVE_PDUMPER
80 pdumper_remember_lv_ptr_raw_impl (ptr, type);
81 #else
82 (void) ptr;
83 (void) type;
84 #endif
85 }
86
87 typedef void (*pdumper_hook)(void);
88 extern void pdumper_do_now_and_after_load_impl (pdumper_hook hook);
89 extern void pdumper_do_now_and_after_late_load_impl (pdumper_hook hook);
90
91 INLINE void
92 pdumper_do_now_and_after_load (pdumper_hook hook)
93 {
94 #ifdef HAVE_PDUMPER
95 pdumper_do_now_and_after_load_impl (hook);
96 #else
97 hook ();
98 #endif
99 }
100
101
102
103 INLINE void
104 pdumper_do_now_and_after_late_load (pdumper_hook hook)
105 {
106 #ifdef HAVE_PDUMPER
107 pdumper_do_now_and_after_late_load_impl (hook);
108 #else
109 hook ();
110 #endif
111 }
112
113
114
115
116
117
118 #define PDUMPER_RESET(variable, value) \
119 do { \
120 if (dumped_with_pdumper_p ()) \
121 (variable) = (value); \
122 else \
123 eassert ((variable) == (value)); \
124 } while (0)
125
126 #define PDUMPER_RESET_LV(variable, value) \
127 do { \
128 if (dumped_with_pdumper_p ()) \
129 (variable) = (value); \
130 else \
131 eassert (EQ ((variable), (value))); \
132 } while (0)
133
134
135
136 enum pdumper_load_result
137 {
138 PDUMPER_LOAD_SUCCESS,
139 PDUMPER_NOT_LOADED ,
140 PDUMPER_LOAD_FILE_NOT_FOUND,
141 PDUMPER_LOAD_BAD_FILE_TYPE,
142 PDUMPER_LOAD_FAILED_DUMP,
143 PDUMPER_LOAD_OOM,
144 PDUMPER_LOAD_VERSION_MISMATCH,
145 PDUMPER_LOAD_ERROR
146 };
147
148 int pdumper_load (const char *dump_filename, char *argv0);
149
150 struct pdumper_loaded_dump
151 {
152 uintptr_t start;
153 uintptr_t end;
154 };
155
156 extern struct pdumper_loaded_dump dump_public;
157
158
159
160
161 INLINE _GL_ATTRIBUTE_CONST bool
162 pdumper_object_p (const void *obj)
163 {
164 #ifdef HAVE_PDUMPER
165 uintptr_t obj_addr = (uintptr_t) obj;
166 return dump_public.start <= obj_addr && obj_addr < dump_public.end;
167 #else
168 (void) obj;
169 return false;
170 #endif
171 }
172
173 extern bool pdumper_cold_object_p_impl (const void *obj);
174
175
176
177
178
179 INLINE _GL_ATTRIBUTE_CONST bool
180 pdumper_cold_object_p (const void *obj)
181 {
182 #ifdef HAVE_PDUMPER
183 return pdumper_cold_object_p_impl (obj);
184 #else
185 (void) obj;
186 return false;
187 #endif
188 }
189
190
191 extern int pdumper_find_object_type_impl (const void *obj);
192
193
194
195
196 INLINE _GL_ATTRIBUTE_CONST int
197 pdumper_find_object_type (const void *obj)
198 {
199 #ifdef HAVE_PDUMPER
200 return pdumper_find_object_type_impl (obj);
201 #else
202 (void) obj;
203 emacs_abort ();
204 #endif
205 }
206
207
208
209 INLINE bool
210 pdumper_valid_object_type_p (int type)
211 {
212 return 0 <= type;
213 }
214
215
216
217
218
219 INLINE _GL_ATTRIBUTE_CONST bool
220 pdumper_object_p_precise (const void *obj)
221 {
222 #ifdef HAVE_PDUMPER
223 return pdumper_valid_object_type_p (pdumper_find_object_type (obj));
224 #else
225 (void) obj;
226 emacs_abort ();
227 #endif
228 }
229
230 extern bool pdumper_marked_p_impl (const void *obj);
231
232
233
234
235 INLINE bool
236 pdumper_marked_p (const void *obj)
237 {
238 #ifdef HAVE_PDUMPER
239 return pdumper_marked_p_impl (obj);
240 #else
241 (void) obj;
242 emacs_abort ();
243 #endif
244 }
245
246 extern void pdumper_set_marked_impl (const void *obj);
247
248
249
250
251 INLINE void
252 pdumper_set_marked (const void *obj)
253 {
254 #ifdef HAVE_PDUMPER
255 pdumper_set_marked_impl (obj);
256 #else
257 (void) obj;
258 emacs_abort ();
259 #endif
260 }
261
262 extern void pdumper_clear_marks_impl (void);
263
264
265 INLINE void
266 pdumper_clear_marks (void)
267 {
268 #ifdef HAVE_PDUMPER
269 pdumper_clear_marks_impl ();
270 #endif
271 }
272
273
274
275 extern void pdumper_record_wd (const char *);
276
277 void init_pdumper_once (void);
278 void syms_of_pdumper (void);
279
280 INLINE_HEADER_END
281 #endif