Mercurial > hg > xemacs-beta
annotate src/gc.h @ 5223:acc4a6c9f5f9
Remove the definition of Q_data from glyphs.c, fixing C++ build.
2010-06-01 Aidan Kehoe <kehoea@parhasard.net>
* glyphs.c (syms_of_glyphs):
Remove the definition of Q_data from this file, now it's in
general-slots.h. Problem picked up by a C++ build.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 01 Jun 2010 20:31:11 +0100 |
parents | 6c6d78781d59 |
children | 308d34e9f07d |
rev | line source |
---|---|
3092 | 1 /* New incremental garbage collector for XEmacs. |
2 Copyright (C) 2005 Marcus Crestani. | |
5169
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
3 Copyright (C) 2010 Ben Wing. |
3092 | 4 |
5 This file is part of XEmacs. | |
6 | |
7 XEmacs is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 2, or (at your option) any | |
10 later version. | |
11 | |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with XEmacs; see the file COPYING. If not, write to | |
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
20 Boston, MA 02111-1307, USA. */ | |
21 | |
22 /* Synched up with: Not in FSF. */ | |
23 | |
24 #ifndef INCLUDED_gc_h_ | |
25 #define INCLUDED_gc_h_ | |
26 | |
27 BEGIN_C_DECLS | |
28 | |
29 | |
30 #ifdef NEW_GC | |
31 /************************************************************************/ | |
32 /* Incremental Statistics */ | |
33 /************************************************************************/ | |
34 #ifdef ERROR_CHECK_GC | |
35 void gc_stat_print_stats (void); | |
36 void gc_stat_finalized (void); | |
37 void gc_stat_freed (void); | |
38 # define GC_STAT_FINALIZED gc_stat_finalized () | |
39 # define GC_STAT_FREED gc_stat_freed () | |
40 #else /* not ERROR_CHECK_GC */ | |
41 # define GC_STAT_FINALIZED | |
42 # define GC_STAT_FREED | |
43 #endif /* not ERROR_CHECK_GC */ | |
44 #endif /* not NEW_GC */ | |
45 | |
46 | |
47 /************************************************************************/ | |
48 /* Global Variables */ | |
49 /************************************************************************/ | |
50 /* Number of bytes of consing done since the last GC. */ | |
51 extern EMACS_INT consing_since_gc; | |
52 | |
53 /* Number of bytes of consing done since startup. */ | |
54 extern EMACS_UINT total_consing; | |
55 | |
56 /* Number of bytes of current allocated heap objects. */ | |
57 extern EMACS_INT total_gc_usage; | |
58 | |
59 /* If the above is set. */ | |
60 extern int total_gc_usage_set; | |
61 | |
62 /* Number of bytes of consing since gc before another gc should be done. */ | |
63 extern EMACS_INT gc_cons_threshold; | |
64 | |
65 /* Percentage of consing of total data size before another GC. */ | |
66 extern EMACS_INT gc_cons_percentage; | |
67 | |
68 #ifdef NEW_GC | |
69 /* Number of bytes of consing since gc before another cycle of the gc | |
70 should be done in incremental mode. */ | |
71 extern EMACS_INT gc_cons_incremental_threshold; | |
72 | |
73 /* Nonzero during gc */ | |
74 extern int gc_in_progress; | |
75 | |
76 /* Nonzero during write barrier */ | |
77 extern int write_barrier_enabled; | |
78 | |
79 /* Enable/disable incremental garbage collection during runtime. */ | |
80 extern int allow_incremental_gc; | |
81 #endif /* NEW_GC */ | |
82 | |
83 | |
84 /************************************************************************/ | |
85 /* Prototypes */ | |
86 /************************************************************************/ | |
87 | |
88 #ifndef MALLOC_OVERHEAD | |
4735
80d74fed5399
Remove "old" GNU malloc in src/malloc.c, and all references to it. Drop the
Jerry James <james@xemacs.org>
parents:
3313
diff
changeset
|
89 #ifndef SYSTEM_MALLOC |
3092 | 90 #define MALLOC_OVERHEAD 0 |
91 #elif defined (rcheck) | |
92 #define MALLOC_OVERHEAD 20 | |
93 #else | |
94 #define MALLOC_OVERHEAD 8 | |
95 #endif | |
96 #endif /* MALLOC_OVERHEAD */ | |
97 | |
98 #ifdef ERROR_CHECK_GC | |
99 #define GC_CHECK_LHEADER_INVARIANTS(lheader) do { \ | |
100 struct lrecord_header * GCLI_lh = (lheader); \ | |
101 assert (GCLI_lh != 0); \ | |
102 assert (GCLI_lh->type < (unsigned int) lrecord_type_count); \ | |
103 } while (0) | |
104 #else | |
105 #define GC_CHECK_LHEADER_INVARIANTS(lheader) | |
106 #endif | |
107 | |
108 void recompute_need_to_garbage_collect (void); | |
109 | |
5169
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
110 #ifdef DEBUG_XEMACS |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
111 #define KKCC_DEBUG_ARGS , level, pos |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
112 #define DECLARE_KKCC_DEBUG_ARGS , int level, int pos |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
113 #else |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
114 #define KKCC_DEBUG_ARGS |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
115 #define DECLARE_KKCC_DEBUG_ARGS |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
116 #endif |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
117 |
3092 | 118 |
119 /* KKCC mark algorithm. */ | |
5169
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
120 void kkcc_gc_stack_push_lisp_object (Lisp_Object obj DECLARE_KKCC_DEBUG_ARGS); |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
121 void kkcc_gc_stack_repush_dirty_object (Lisp_Object obj |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
122 DECLARE_KKCC_DEBUG_ARGS); |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
123 |
3092 | 124 #ifdef DEBUG_XEMACS |
5169
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
125 #define kkcc_gc_stack_push_lisp_object_0(obj) \ |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
126 kkcc_gc_stack_push_lisp_object (obj, 0, -1) |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
127 void kkcc_backtrace_1 (int size, int detailed); |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
128 void kkcc_short_backtrace (void); |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
129 void kkcc_detailed_backtrace (void); |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
130 void kkcc_short_backtrace_full (void); |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
131 void kkcc_detailed_backtrace_full (void); |
3092 | 132 #else |
5169
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
133 #define kkcc_gc_stack_push_lisp_object_0(obj) \ |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
134 kkcc_gc_stack_push_lisp_object (obj) |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
135 #define kkcc_detailed_backtrace() |
3092 | 136 #endif |
137 | |
138 #ifdef NEW_GC | |
139 | |
140 /* Repush objects that are caught by the write barrier. */ | |
5169
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
141 #ifdef DEBUG_XEMACS |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
142 #define gc_write_barrier(obj) kkcc_gc_stack_repush_dirty_object (obj, 0, -2) |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
143 #else |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
144 #define gc_write_barrier(obj) kkcc_gc_stack_repush_dirty_object (obj) |
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
4735
diff
changeset
|
145 #endif |
3092 | 146 |
147 /* GC functions: */ | |
148 | |
149 /* Perform a full garbage collection without interruption. If an | |
150 incremental garbage collection is already running it is completed | |
151 without further interruption. This function calls gc() with a | |
152 negative or zero argument. */ | |
153 void gc_full (void); | |
154 | |
155 /* This function starts an incremental garbage collection. If an | |
156 incremental garbage collection is already running, the next cycle | |
157 of traversal work is done, or the garbage collection is completed | |
158 when no more traversal work has to be done. This function calls gc | |
159 with a positive argument, indicating how many objects can be | |
160 traversed in this cycle. */ | |
161 void gc_incremental (void); | |
162 #endif /* NEW_GC */ | |
163 | |
164 /* Initializers */ | |
165 void init_gc_early (void); | |
166 void reinit_gc_early (void); | |
167 void init_gc_once_early (void); | |
168 | |
169 void syms_of_gc (void); | |
170 void vars_of_gc (void); | |
171 void complex_vars_of_gc (void); | |
172 | |
173 #ifndef NEW_GC | |
174 /* Needed prototypes due to the garbage collector code move from | |
175 alloc.c to gc.c. */ | |
176 void gc_sweep_1 (void); | |
177 | |
178 extern void *breathing_space; | |
179 #endif /* not NEW_GC */ | |
180 | |
3263 | 181 #ifdef NEW_GC |
182 void add_finalizable_obj (Lisp_Object obj); | |
183 void register_for_finalization (void); | |
184 void run_finalizers (void); | |
185 #endif /* NEW_GC */ | |
186 | |
3092 | 187 END_C_DECLS |
188 | |
189 #endif /* INCLUDED_gc_h_ */ |