Mercurial > hg > xemacs-beta
annotate src/gc.h @ 4735:80d74fed5399
Remove "old" GNU malloc in src/malloc.c, and all references to it. Drop the
GNU_MALLOC define, which was only used to distinguish between "old" and "new"
GNU malloc. See xemacs-patches message with ID
<870180fe0911061348g168f85e2m5153e2b554b94803@mail.gmail.com>.
author | Jerry James <james@xemacs.org> |
---|---|
date | Mon, 09 Nov 2009 09:21:59 -0700 |
parents | 509d2981ffea |
children | 6c6d78781d59 |
rev | line source |
---|---|
3092 | 1 /* New incremental garbage collector for XEmacs. |
2 Copyright (C) 2005 Marcus Crestani. | |
3 | |
4 This file is part of XEmacs. | |
5 | |
6 XEmacs is free software; you can redistribute it and/or modify it | |
7 under the terms of the GNU General Public License as published by the | |
8 Free Software Foundation; either version 2, or (at your option) any | |
9 later version. | |
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 | |
17 along with XEmacs; see the file COPYING. If not, write to | |
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
19 Boston, MA 02111-1307, USA. */ | |
20 | |
21 /* Synched up with: Not in FSF. */ | |
22 | |
23 #ifndef INCLUDED_gc_h_ | |
24 #define INCLUDED_gc_h_ | |
25 | |
26 BEGIN_C_DECLS | |
27 | |
28 | |
29 #ifdef NEW_GC | |
30 /************************************************************************/ | |
31 /* Incremental Statistics */ | |
32 /************************************************************************/ | |
33 #ifdef ERROR_CHECK_GC | |
34 void gc_stat_print_stats (void); | |
35 void gc_stat_finalized (void); | |
36 void gc_stat_freed (void); | |
37 # define GC_STAT_FINALIZED gc_stat_finalized () | |
38 # define GC_STAT_FREED gc_stat_freed () | |
39 #else /* not ERROR_CHECK_GC */ | |
40 # define GC_STAT_FINALIZED | |
41 # define GC_STAT_FREED | |
42 #endif /* not ERROR_CHECK_GC */ | |
43 #endif /* not NEW_GC */ | |
44 | |
45 | |
46 /************************************************************************/ | |
47 /* Global Variables */ | |
48 /************************************************************************/ | |
49 /* Number of bytes of consing done since the last GC. */ | |
50 extern EMACS_INT consing_since_gc; | |
51 | |
52 /* Number of bytes of consing done since startup. */ | |
53 extern EMACS_UINT total_consing; | |
54 | |
55 /* Number of bytes of current allocated heap objects. */ | |
56 extern EMACS_INT total_gc_usage; | |
57 | |
58 /* If the above is set. */ | |
59 extern int total_gc_usage_set; | |
60 | |
61 /* Number of bytes of consing since gc before another gc should be done. */ | |
62 extern EMACS_INT gc_cons_threshold; | |
63 | |
64 /* Percentage of consing of total data size before another GC. */ | |
65 extern EMACS_INT gc_cons_percentage; | |
66 | |
67 #ifdef NEW_GC | |
68 /* Number of bytes of consing since gc before another cycle of the gc | |
69 should be done in incremental mode. */ | |
70 extern EMACS_INT gc_cons_incremental_threshold; | |
71 | |
72 /* Nonzero during gc */ | |
73 extern int gc_in_progress; | |
74 | |
75 /* Nonzero during write barrier */ | |
76 extern int write_barrier_enabled; | |
77 | |
78 /* Enable/disable incremental garbage collection during runtime. */ | |
79 extern int allow_incremental_gc; | |
80 #endif /* NEW_GC */ | |
81 | |
82 | |
83 /************************************************************************/ | |
84 /* Prototypes */ | |
85 /************************************************************************/ | |
86 | |
87 #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
|
88 #ifndef SYSTEM_MALLOC |
3092 | 89 #define MALLOC_OVERHEAD 0 |
90 #elif defined (rcheck) | |
91 #define MALLOC_OVERHEAD 20 | |
92 #else | |
93 #define MALLOC_OVERHEAD 8 | |
94 #endif | |
95 #endif /* MALLOC_OVERHEAD */ | |
96 | |
97 #ifdef ERROR_CHECK_GC | |
98 #define GC_CHECK_LHEADER_INVARIANTS(lheader) do { \ | |
99 struct lrecord_header * GCLI_lh = (lheader); \ | |
100 assert (GCLI_lh != 0); \ | |
101 assert (GCLI_lh->type < (unsigned int) lrecord_type_count); \ | |
102 } while (0) | |
103 #else | |
104 #define GC_CHECK_LHEADER_INVARIANTS(lheader) | |
105 #endif | |
106 | |
107 void recompute_need_to_garbage_collect (void); | |
108 | |
109 | |
110 /* KKCC mark algorithm. */ | |
111 #ifdef DEBUG_XEMACS | |
112 void kkcc_gc_stack_push_lisp_object_1 (Lisp_Object obj, int level, int pos); | |
113 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \ | |
114 kkcc_gc_stack_push_lisp_object_1 (obj, level, pos) | |
115 void kkcc_gc_stack_repush_dirty_object_1 (Lisp_Object obj, int level, int pos); | |
116 #define kkcc_gc_stack_repush_dirty_object(obj) \ | |
117 kkcc_gc_stack_repush_dirty_object_1 (obj, 0, -2) | |
118 void kkcc_backtrace (void); | |
119 #else | |
120 void kkcc_gc_stack_push_lisp_object_1 (Lisp_Object obj); | |
121 #define kkcc_gc_stack_push_lisp_object(obj, level, pos) \ | |
122 kkcc_gc_stack_push_lisp_object_1 (obj) | |
123 void kkcc_gc_stack_repush_dirty_object_1 (Lisp_Object obj); | |
124 #define kkcc_gc_stack_repush_dirty_object(obj) \ | |
125 kkcc_gc_stack_repush_dirty_object_1 (obj) | |
126 #define kkcc_backtrace() | |
127 #endif | |
128 | |
129 #ifdef NEW_GC | |
130 | |
131 /* Repush objects that are caught by the write barrier. */ | |
132 #define gc_write_barrier(obj) kkcc_gc_stack_repush_dirty_object (obj); | |
133 | |
134 | |
135 /* GC functions: */ | |
136 | |
137 /* Perform a full garbage collection without interruption. If an | |
138 incremental garbage collection is already running it is completed | |
139 without further interruption. This function calls gc() with a | |
140 negative or zero argument. */ | |
141 void gc_full (void); | |
142 | |
143 /* This function starts an incremental garbage collection. If an | |
144 incremental garbage collection is already running, the next cycle | |
145 of traversal work is done, or the garbage collection is completed | |
146 when no more traversal work has to be done. This function calls gc | |
147 with a positive argument, indicating how many objects can be | |
148 traversed in this cycle. */ | |
149 void gc_incremental (void); | |
150 #endif /* NEW_GC */ | |
151 | |
152 /* Initializers */ | |
153 void init_gc_early (void); | |
154 void reinit_gc_early (void); | |
155 void init_gc_once_early (void); | |
156 | |
157 void syms_of_gc (void); | |
158 void vars_of_gc (void); | |
159 void complex_vars_of_gc (void); | |
160 | |
161 #ifndef NEW_GC | |
162 /* Needed prototypes due to the garbage collector code move from | |
163 alloc.c to gc.c. */ | |
164 void gc_sweep_1 (void); | |
165 | |
166 extern void *breathing_space; | |
167 #endif /* not NEW_GC */ | |
168 | |
3263 | 169 #ifdef NEW_GC |
170 void add_finalizable_obj (Lisp_Object obj); | |
171 void register_for_finalization (void); | |
172 void run_finalizers (void); | |
173 #endif /* NEW_GC */ | |
174 | |
3092 | 175 END_C_DECLS |
176 | |
177 #endif /* INCLUDED_gc_h_ */ |