Mercurial > hg > xemacs-beta
comparison src/mc-alloc.h @ 3263:d674024a8674
[xemacs-hg @ 2006-02-27 16:29:00 by crestani]
- Introduce a fancy asynchronous finalization strategy on C level.
- Merge the code conditioned on MC_ALLOC into the code conditioned on
NEW_GC.
- Remove the possibility to free objects manually outside garbage
collections when the new collector is enabled.
author | crestani |
---|---|
date | Mon, 27 Feb 2006 16:29:29 +0000 |
parents | 141c2920ea48 |
children | 619edf713d55 |
comparison
equal
deleted
inserted
replaced
3262:79d41cfd8e6b | 3263:d674024a8674 |
---|---|
70 | 70 |
71 | 71 |
72 | 72 |
73 /* Garbage collection related functions and macros: */ | 73 /* Garbage collection related functions and macros: */ |
74 | 74 |
75 #ifdef NEW_GC | |
76 enum mark_bit_colors | 75 enum mark_bit_colors |
77 { | 76 { |
78 WHITE = 0, | 77 WHITE = 0, |
79 BLACK = 1, | 78 BLACK = 1, |
80 GREY = 2 | 79 GREY = 2 |
101 #define MARK_BLACK(ptr) set_mark_bit (ptr, BLACK) | 100 #define MARK_BLACK(ptr) set_mark_bit (ptr, BLACK) |
102 | 101 |
103 #define MARKED_WHITE_P(ptr) (get_mark_bit (ptr) == WHITE) | 102 #define MARKED_WHITE_P(ptr) (get_mark_bit (ptr) == WHITE) |
104 #define MARKED_GREY_P(ptr) (get_mark_bit (ptr) == GREY) | 103 #define MARKED_GREY_P(ptr) (get_mark_bit (ptr) == GREY) |
105 #define MARKED_BLACK_P(ptr) (get_mark_bit (ptr) == BLACK) | 104 #define MARKED_BLACK_P(ptr) (get_mark_bit (ptr) == BLACK) |
106 #else /* not NEW_GC */ | |
107 /* Set the mark bit of the object pointed to by ptr to value.*/ | |
108 void set_mark_bit (void *ptr, EMACS_INT value); | |
109 | |
110 /* Return the mark bit of the object pointed to by ptr. */ | |
111 EMACS_INT get_mark_bit (void *ptr); | |
112 | |
113 /* mark bit macros */ | |
114 /* Returns true if the mark bit of the object pointed to by ptr is set. */ | |
115 #define MARKED_P(ptr) (get_mark_bit (ptr) == 1) | |
116 | |
117 /* Marks the object pointed to by ptr (sets the mark bit to 1). */ | |
118 #define MARK(ptr) set_mark_bit (ptr, 1) | |
119 | |
120 /* Unmarks the object pointed to by ptr (sets the mark bit to 0). */ | |
121 #define UNMARK(ptr) set_mark_bit (ptr, 0) | |
122 #endif /* not NEW_GC */ | |
123 | 105 |
124 /* The finalizer of every not marked object is called. The macro | 106 /* The finalizer of every not marked object is called. The macro |
125 MC_ALLOC_CALL_FINALIZER has to be defined and call the finalizer of | 107 MC_ALLOC_CALL_FINALIZER has to be defined and call the finalizer of |
126 the object. */ | 108 the object. */ |
127 void mc_finalize (void); | 109 void mc_finalize (void); |
148 Bytecount mc_alloced_storage_size (Bytecount claimed_size, | 130 Bytecount mc_alloced_storage_size (Bytecount claimed_size, |
149 struct overhead_stats *stats); | 131 struct overhead_stats *stats); |
150 #endif /* MEMORY_USAGE_STATS */ | 132 #endif /* MEMORY_USAGE_STATS */ |
151 | 133 |
152 | 134 |
153 #ifdef NEW_GC | |
154 /* Incremental Garbage Collector / Write Barrier Support: */ | 135 /* Incremental Garbage Collector / Write Barrier Support: */ |
155 | 136 |
156 /* Return the PAGESIZE the allocator uses. Generally equals to the | 137 /* Return the PAGESIZE the allocator uses. Generally equals to the |
157 system's PAGESIZE. */ | 138 system's PAGESIZE. */ |
158 EMACS_INT mc_get_page_size (void); | 139 EMACS_INT mc_get_page_size (void); |
178 EMACS_INT maybe_mark_black (void *ptr); | 159 EMACS_INT maybe_mark_black (void *ptr); |
179 | 160 |
180 /* Only for debugging---not used anywhere in the sources. */ | 161 /* Only for debugging---not used anywhere in the sources. */ |
181 EMACS_INT object_on_heap_p (void *ptr); | 162 EMACS_INT object_on_heap_p (void *ptr); |
182 | 163 |
183 #endif /* NEW_GC */ | |
184 | |
185 END_C_DECLS | 164 END_C_DECLS |
186 | 165 |
187 #endif /* INCLUDED_mc_alloc_h_ */ | 166 #endif /* INCLUDED_mc_alloc_h_ */ |