Don't rebuild everything all the time
[cacao.git] / src / boehm-gc / include / gc.h
1 /* 
2  * Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
3  * Copyright (c) 1991-1995 by Xerox Corporation.  All rights reserved.
4  * Copyright 1996-1999 by Silicon Graphics.  All rights reserved.
5  * Copyright 1999 by Hewlett-Packard Company.  All rights reserved.
6  *
7  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
9  *
10  * Permission is hereby granted to use or copy this program
11  * for any purpose,  provided the above notices are retained on all copies.
12  * Permission to modify the code and to distribute modified code is granted,
13  * provided the above notices are retained, and a notice that the code was
14  * modified is included with the above copyright notice.
15  */
16
17 /*
18  * Note that this defines a large number of tuning hooks, which can
19  * safely be ignored in nearly all cases.  For normal use it suffices
20  * to call only GC_MALLOC and perhaps GC_REALLOC.
21  * For better performance, also look at GC_MALLOC_ATOMIC, and
22  * GC_enable_incremental.  If you need an action to be performed
23  * immediately before an object is collected, look at GC_register_finalizer.
24  * If you are using Solaris threads, look at the end of this file.
25  * Everything else is best ignored unless you encounter performance
26  * problems.
27  */
28  
29 #ifndef _GC_H
30
31 # define _GC_H
32
33 # include "gc_config_macros.h"
34
35 # if defined(__STDC__) || defined(__cplusplus)
36 #   define GC_PROTO(args) args
37     typedef void * GC_PTR;
38 #   define GC_CONST const
39 # else
40 #   define GC_PROTO(args) ()
41     typedef char * GC_PTR;
42 #   define GC_CONST
43 #  endif
44
45 # ifdef __cplusplus
46     extern "C" {
47 # endif
48
49
50 /* Define word and signed_word to be unsigned and signed types of the   */
51 /* size as char * or void *.  There seems to be no way to do this       */
52 /* even semi-portably.  The following is probably no better/worse       */
53 /* than almost anything else.                                           */
54 /* The ANSI standard suggests that size_t and ptr_diff_t might be       */
55 /* better choices.  But those appear to have incorrect definitions      */
56 /* on may systems.  Notably "typedef int size_t" seems to be both       */
57 /* frequent and WRONG.                                                  */
58 typedef unsigned long GC_word;
59 typedef long GC_signed_word;
60
61 /* Public read-only variables */
62
63 GC_API GC_word GC_gc_no;/* Counter incremented per collection.          */
64                         /* Includes empty GCs at startup.               */
65
66 GC_API int GC_parallel; /* GC is parallelized for performance on        */
67                         /* multiprocessors.  Currently set only         */
68                         /* implicitly if collector is built with        */
69                         /* -DPARALLEL_MARK and if either:               */
70                         /*  Env variable GC_NPROC is set to > 1, or     */
71                         /*  GC_NPROC is not set and this is an MP.      */
72                         /* If GC_parallel is set, incremental           */
73                         /* collection is only partially functional,     */
74                         /* and may not be desirable.                    */
75                         
76
77 /* Public R/W variables */
78
79 GC_API GC_PTR (*GC_oom_fn) GC_PROTO((size_t bytes_requested));
80                         /* When there is insufficient memory to satisfy */
81                         /* an allocation request, we return             */
82                         /* (*GC_oom_fn)().  By default this just        */
83                         /* returns 0.                                   */
84                         /* If it returns, it must return 0 or a valid   */
85                         /* pointer to a previously allocated heap       */
86                         /* object.                                      */
87
88 GC_API int GC_find_leak;
89                         /* Do not actually garbage collect, but simply  */
90                         /* report inaccessible memory that was not      */
91                         /* deallocated with GC_free.  Initial value     */
92                         /* is determined by FIND_LEAK macro.            */
93
94 GC_API int GC_all_interior_pointers;
95                         /* Arrange for pointers to object interiors to  */
96                         /* be recognized as valid.  May not be changed  */
97                         /* after GC initialization.                     */
98                         /* Initial value is determined by               */
99                         /* -DALL_INTERIOR_POINTERS.                     */
100                         /* Unless DONT_ADD_BYTE_AT_END is defined, this */
101                         /* also affects whether sizes are increased by  */
102                         /* at least a byte to allow "off the end"       */
103                         /* pointer recognition.                         */
104                         /* MUST BE 0 or 1.                              */
105
106 GC_API int GC_quiet;    /* Disable statistics output.  Only matters if  */
107                         /* collector has been compiled with statistics  */
108                         /* enabled.  This involves a performance cost,  */
109                         /* and is thus not the default.                 */
110
111 GC_API int GC_finalize_on_demand;
112                         /* If nonzero, finalizers will only be run in   */
113                         /* response to an explicit GC_invoke_finalizers */
114                         /* call.  The default is determined by whether  */
115                         /* the FINALIZE_ON_DEMAND macro is defined      */
116                         /* when the collector is built.                 */
117
118 GC_API int GC_java_finalization;
119                         /* Mark objects reachable from finalizable      */
120                         /* objects in a separate postpass.  This makes  */
121                         /* it a bit safer to use non-topologically-     */
122                         /* ordered finalization.  Default value is      */
123                         /* determined by JAVA_FINALIZATION macro.       */
124
125 GC_API void (* GC_finalizer_notifier)();
126                         /* Invoked by the collector when there are      */
127                         /* objects to be finalized.  Invoked at most    */
128                         /* once per GC cycle.  Never invoked unless     */
129                         /* GC_finalize_on_demand is set.                */
130                         /* Typically this will notify a finalization    */
131                         /* thread, which will call GC_invoke_finalizers */
132                         /* in response.                                 */
133
134 GC_API int GC_dont_gc;  /* != 0 ==> Dont collect.  In versions 7.2a1+,  */
135                         /* this overrides explicit GC_gcollect() calls. */
136                         /* Used as a counter, so that nested enabling   */
137                         /* and disabling work correctly.  Should        */
138                         /* normally be updated with GC_enable() and     */
139                         /* GC_disable() calls.                          */
140                         /* Direct assignment to GC_dont_gc is           */
141                         /* deprecated.                                  */
142
143 GC_API int GC_dont_expand;
144                         /* Dont expand heap unless explicitly requested */
145                         /* or forced to.                                */
146
147 GC_API int GC_use_entire_heap;
148                 /* Causes the nonincremental collector to use the       */
149                 /* entire heap before collecting.  This was the only    */
150                 /* option for GC versions < 5.0.  This sometimes        */
151                 /* results in more large block fragmentation, since     */
152                 /* very larg blocks will tend to get broken up          */
153                 /* during each GC cycle.  It is likely to result in a   */
154                 /* larger working set, but lower collection             */
155                 /* frequencies, and hence fewer instructions executed   */
156                 /* in the collector.                                    */
157
158 GC_API int GC_full_freq;    /* Number of partial collections between    */
159                             /* full collections.  Matters only if       */
160                             /* GC_incremental is set.                   */
161                             /* Full collections are also triggered if   */
162                             /* the collector detects a substantial      */
163                             /* increase in the number of in-use heap    */
164                             /* blocks.  Values in the tens are now      */
165                             /* perfectly reasonable, unlike for         */
166                             /* earlier GC versions.                     */
167                         
168 GC_API GC_word GC_non_gc_bytes;
169                         /* Bytes not considered candidates for collection. */
170                         /* Used only to control scheduling of collections. */
171                         /* Updated by GC_malloc_uncollectable and GC_free. */
172                         /* Wizards only.                                   */
173
174 GC_API int GC_no_dls;
175                         /* Don't register dynamic library data segments. */
176                         /* Wizards only.  Should be used only if the     */
177                         /* application explicitly registers all roots.   */
178                         /* In Microsoft Windows environments, this will  */
179                         /* usually also prevent registration of the      */
180                         /* main data segment as part of the root set.    */
181
182 GC_API GC_word GC_free_space_divisor;
183                         /* We try to make sure that we allocate at      */
184                         /* least N/GC_free_space_divisor bytes between  */
185                         /* collections, where N is the heap size plus   */
186                         /* a rough estimate of the root set size.       */
187                         /* Initially, GC_free_space_divisor = 4.        */
188                         /* Increasing its value will use less space     */
189                         /* but more collection time.  Decreasing it     */
190                         /* will appreciably decrease collection time    */
191                         /* at the expense of space.                     */
192                         /* GC_free_space_divisor = 1 will effectively   */
193                         /* disable collections.                         */
194
195 GC_API GC_word GC_max_retries;
196                         /* The maximum number of GCs attempted before   */
197                         /* reporting out of memory after heap           */
198                         /* expansion fails.  Initially 0.               */
199                         
200
201 GC_API char *GC_stackbottom;    /* Cool end of user stack.              */
202                                 /* May be set in the client prior to    */
203                                 /* calling any GC_ routines.  This      */
204                                 /* avoids some overhead, and            */
205                                 /* potentially some signals that can    */
206                                 /* confuse debuggers.  Otherwise the    */
207                                 /* collector attempts to set it         */
208                                 /* automatically.                       */
209                                 /* For multithreaded code, this is the  */
210                                 /* cold end of the stack for the        */
211                                 /* primordial thread.                   */      
212                                 
213 GC_API int GC_dont_precollect;  /* Don't collect as part of             */
214                                 /* initialization.  Should be set only  */
215                                 /* if the client wants a chance to      */
216                                 /* manually initialize the root set     */
217                                 /* before the first collection.         */
218                                 /* Interferes with blacklisting.        */
219                                 /* Wizards only.                        */
220
221 GC_API unsigned long GC_time_limit;
222                                 /* If incremental collection is enabled, */
223                                 /* We try to terminate collections       */
224                                 /* after this many milliseconds.  Not a  */
225                                 /* hard time bound.  Setting this to     */
226                                 /* GC_TIME_UNLIMITED will essentially    */
227                                 /* disable incremental collection while  */
228                                 /* leaving generational collection       */
229                                 /* enabled.                              */
230 #       define GC_TIME_UNLIMITED 999999
231                                 /* Setting GC_time_limit to this value   */
232                                 /* will disable the "pause time exceeded"*/
233                                 /* tests.                                */
234
235 /* Public procedures */
236
237 /* Initialize the collector.  This is only required when using thread-local
238  * allocation, since unlike the regular allocation routines, GC_local_malloc
239  * is not self-initializing.  If you use GC_local_malloc you should arrange
240  * to call this somehow (e.g. from a constructor) before doing any allocation.
241  */
242 GC_API void GC_init GC_PROTO((void));
243
244 /*
245  * general purpose allocation routines, with roughly malloc calling conv.
246  * The atomic versions promise that no relevant pointers are contained
247  * in the object.  The nonatomic versions guarantee that the new object
248  * is cleared.  GC_malloc_stubborn promises that no changes to the object
249  * will occur after GC_end_stubborn_change has been called on the
250  * result of GC_malloc_stubborn. GC_malloc_uncollectable allocates an object
251  * that is scanned for pointers to collectable objects, but is not itself
252  * collectable.  The object is scanned even if it does not appear to
253  * be reachable.  GC_malloc_uncollectable and GC_free called on the resulting
254  * object implicitly update GC_non_gc_bytes appropriately.
255  *
256  * Note that the GC_malloc_stubborn support is stubbed out by default
257  * starting in 6.0.  GC_malloc_stubborn is an alias for GC_malloc unless
258  * the collector is built with STUBBORN_ALLOC defined.
259  */
260 GC_API GC_PTR GC_malloc GC_PROTO((size_t size_in_bytes));
261 GC_API GC_PTR GC_malloc_atomic GC_PROTO((size_t size_in_bytes));
262 GC_API GC_PTR GC_malloc_uncollectable GC_PROTO((size_t size_in_bytes));
263 GC_API GC_PTR GC_malloc_stubborn GC_PROTO((size_t size_in_bytes));
264
265 /* The following is only defined if the library has been suitably       */
266 /* compiled:                                                            */
267 GC_API GC_PTR GC_malloc_atomic_uncollectable GC_PROTO((size_t size_in_bytes));
268
269 /* Explicitly deallocate an object.  Dangerous if used incorrectly.     */
270 /* Requires a pointer to the base of an object.                         */
271 /* If the argument is stubborn, it should not be changeable when freed. */
272 /* An object should not be enable for finalization when it is           */
273 /* explicitly deallocated.                                              */
274 /* GC_free(0) is a no-op, as required by ANSI C for free.               */
275 GC_API void GC_free GC_PROTO((GC_PTR object_addr));
276
277 /*
278  * Stubborn objects may be changed only if the collector is explicitly informed.
279  * The collector is implicitly informed of coming change when such
280  * an object is first allocated.  The following routines inform the
281  * collector that an object will no longer be changed, or that it will
282  * once again be changed.  Only nonNIL pointer stores into the object
283  * are considered to be changes.  The argument to GC_end_stubborn_change
284  * must be exacly the value returned by GC_malloc_stubborn or passed to
285  * GC_change_stubborn.  (In the second case it may be an interior pointer
286  * within 512 bytes of the beginning of the objects.)
287  * There is a performance penalty for allowing more than
288  * one stubborn object to be changed at once, but it is acceptable to
289  * do so.  The same applies to dropping stubborn objects that are still
290  * changeable.
291  */
292 GC_API void GC_change_stubborn GC_PROTO((GC_PTR));
293 GC_API void GC_end_stubborn_change GC_PROTO((GC_PTR));
294
295 /* Return a pointer to the base (lowest address) of an object given     */
296 /* a pointer to a location within the object.                           */
297 /* I.e. map an interior pointer to the corresponding bas pointer.       */
298 /* Note that with debugging allocation, this returns a pointer to the   */
299 /* actual base of the object, i.e. the debug information, not to        */
300 /* the base of the user object.                                         */
301 /* Return 0 if displaced_pointer doesn't point to within a valid        */
302 /* object.                                                              */
303 GC_API GC_PTR GC_base GC_PROTO((GC_PTR displaced_pointer));
304
305 /* Given a pointer to the base of an object, return its size in bytes.  */
306 /* The returned size may be slightly larger than what was originally    */
307 /* requested.                                                           */
308 GC_API size_t GC_size GC_PROTO((GC_PTR object_addr));
309
310 /* For compatibility with C library.  This is occasionally faster than  */
311 /* a malloc followed by a bcopy.  But if you rely on that, either here  */
312 /* or with the standard C library, your code is broken.  In my          */
313 /* opinion, it shouldn't have been invented, but now we're stuck. -HB   */
314 /* The resulting object has the same kind as the original.              */
315 /* If the argument is stubborn, the result will have changes enabled.   */
316 /* It is an error to have changes enabled for the original object.      */
317 /* Follows ANSI comventions for NULL old_object.                        */
318 GC_API GC_PTR GC_realloc
319         GC_PROTO((GC_PTR old_object, size_t new_size_in_bytes));
320                                    
321 /* Explicitly increase the heap size.   */
322 /* Returns 0 on failure, 1 on success.  */
323 GC_API int GC_expand_hp GC_PROTO((size_t number_of_bytes));
324
325 /* Limit the heap size to n bytes.  Useful when you're debugging,       */
326 /* especially on systems that don't handle running out of memory well.  */
327 /* n == 0 ==> unbounded.  This is the default.                          */
328 GC_API void GC_set_max_heap_size GC_PROTO((GC_word n));
329
330 /* Inform the collector that a certain section of statically allocated  */
331 /* memory contains no pointers to garbage collected memory.  Thus it    */
332 /* need not be scanned.  This is sometimes important if the application */
333 /* maps large read/write files into the address space, which could be   */
334 /* mistaken for dynamic library data segments on some systems.          */
335 GC_API void GC_exclude_static_roots GC_PROTO((GC_PTR start, GC_PTR finish));
336
337 /* Clear the set of root segments.  Wizards only. */
338 GC_API void GC_clear_roots GC_PROTO((void));
339
340 /* Add a root segment.  Wizards only. */
341 GC_API void GC_add_roots GC_PROTO((char * low_address,
342                                    char * high_address_plus_1));
343
344 /* Remove a root segment.  Wizards only. */
345 GC_API void GC_remove_roots GC_PROTO((char * low_address, 
346     char * high_address_plus_1));
347
348 /* Add a displacement to the set of those considered valid by the       */
349 /* collector.  GC_register_displacement(n) means that if p was returned */
350 /* by GC_malloc, then (char *)p + n will be considered to be a valid    */
351 /* pointer to p.  N must be small and less than the size of p.          */
352 /* (All pointers to the interior of objects from the stack are          */
353 /* considered valid in any case.  This applies to heap objects and      */
354 /* static data.)                                                        */
355 /* Preferably, this should be called before any other GC procedures.    */
356 /* Calling it later adds to the probability of excess memory            */
357 /* retention.                                                           */
358 /* This is a no-op if the collector has recognition of                  */
359 /* arbitrary interior pointers enabled, which is now the default.       */
360 GC_API void GC_register_displacement GC_PROTO((GC_word n));
361
362 /* The following version should be used if any debugging allocation is  */
363 /* being done.                                                          */
364 GC_API void GC_debug_register_displacement GC_PROTO((GC_word n));
365
366 /* Explicitly trigger a full, world-stop collection.    */
367 GC_API void GC_gcollect GC_PROTO((void));
368
369 /* Trigger a full world-stopped collection.  Abort the collection if    */
370 /* and when stop_func returns a nonzero value.  Stop_func will be       */
371 /* called frequently, and should be reasonably fast.  This works even   */
372 /* if virtual dirty bits, and hence incremental collection is not       */
373 /* available for this architecture.  Collections can be aborted faster  */
374 /* than normal pause times for incremental collection.  However,        */
375 /* aborted collections do no useful work; the next collection needs     */
376 /* to start from the beginning.                                         */
377 /* Return 0 if the collection was aborted, 1 if it succeeded.           */
378 typedef int (* GC_stop_func) GC_PROTO((void));
379 GC_API int GC_try_to_collect GC_PROTO((GC_stop_func stop_func));
380
381 /* Return the number of bytes in the heap.  Excludes collector private  */
382 /* data structures.  Includes empty blocks and fragmentation loss.      */
383 /* Includes some pages that were allocated but never written.           */
384 GC_API size_t GC_get_heap_size GC_PROTO((void));
385
386 /* Return a lower bound on the number of free bytes in the heap.        */
387 GC_API size_t GC_get_free_bytes GC_PROTO((void));
388
389 /* Return the number of bytes allocated since the last collection.      */
390 GC_API size_t GC_get_bytes_since_gc GC_PROTO((void));
391
392 /* Return the total number of bytes allocated in this process.          */
393 /* Never decreases, except due to wrapping.                             */
394 GC_API size_t GC_get_total_bytes GC_PROTO((void));
395
396 /* Disable garbage collection.  Even GC_gcollect calls will be          */
397 /* ineffective.                                                         */
398 GC_API void GC_disable GC_PROTO((void));
399
400 /* Reenable garbage collection.  GC_diable() and GC_enable() calls      */
401 /* nest.  Garbage collection is enabled if the number of calls to both  */
402 /* both functions is equal.                                             */
403 GC_API void GC_enable GC_PROTO((void));
404
405 /* Enable incremental/generational collection.  */
406 /* Not advisable unless dirty bits are          */
407 /* available or most heap objects are           */
408 /* pointerfree(atomic) or immutable.            */
409 /* Don't use in leak finding mode.              */
410 /* Ignored if GC_dont_gc is true.               */
411 /* Only the generational piece of this is       */
412 /* functional if GC_parallel is TRUE            */
413 /* or if GC_time_limit is GC_TIME_UNLIMITED.    */
414 /* Causes GC_local_gcj_malloc() to revert to    */
415 /* locked allocation.  Must be called           */
416 /* before any GC_local_gcj_malloc() calls.      */
417 GC_API void GC_enable_incremental GC_PROTO((void));
418
419 /* Does incremental mode write-protect pages?  Returns zero or  */
420 /* more of the following, or'ed together:                       */
421 #define GC_PROTECTS_POINTER_HEAP  1 /* May protect non-atomic objs.     */
422 #define GC_PROTECTS_PTRFREE_HEAP  2
423 #define GC_PROTECTS_STATIC_DATA   4 /* Curently never.                  */
424 #define GC_PROTECTS_STACK         8 /* Probably impractical.            */
425
426 #define GC_PROTECTS_NONE 0
427 GC_API int GC_incremental_protection_needs GC_PROTO((void));
428
429 /* Perform some garbage collection work, if appropriate.        */
430 /* Return 0 if there is no more work to be done.                */
431 /* Typically performs an amount of work corresponding roughly   */
432 /* to marking from one page.  May do more work if further       */
433 /* progress requires it, e.g. if incremental collection is      */
434 /* disabled.  It is reasonable to call this in a wait loop      */
435 /* until it returns 0.                                          */
436 GC_API int GC_collect_a_little GC_PROTO((void));
437
438 /* Allocate an object of size lb bytes.  The client guarantees that     */
439 /* as long as the object is live, it will be referenced by a pointer    */
440 /* that points to somewhere within the first 256 bytes of the object.   */
441 /* (This should normally be declared volatile to prevent the compiler   */
442 /* from invalidating this assertion.)  This routine is only useful      */
443 /* if a large array is being allocated.  It reduces the chance of       */
444 /* accidentally retaining such an array as a result of scanning an      */
445 /* integer that happens to be an address inside the array.  (Actually,  */
446 /* it reduces the chance of the allocator not finding space for such    */
447 /* an array, since it will try hard to avoid introducing such a false   */
448 /* reference.)  On a SunOS 4.X or MS Windows system this is recommended */
449 /* for arrays likely to be larger than 100K or so.  For other systems,  */
450 /* or if the collector is not configured to recognize all interior      */
451 /* pointers, the threshold is normally much higher.                     */
452 GC_API GC_PTR GC_malloc_ignore_off_page GC_PROTO((size_t lb));
453 GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
454
455 #if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION >= 720
456 #   define GC_ADD_CALLER
457 #   define GC_RETURN_ADDR (GC_word)__return_address
458 #endif
459
460 #ifdef __linux__
461 # include <features.h>
462 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
463      && !defined(__ia64__)
464 #   define GC_HAVE_BUILTIN_BACKTRACE
465 #   define GC_CAN_SAVE_CALL_STACKS
466 # endif
467 # if defined(__i386__) || defined(__x86_64__)
468 #   define GC_CAN_SAVE_CALL_STACKS
469 # endif
470 #endif
471
472 #if defined(__sparc__)
473 #   define GC_CAN_SAVE_CALL_STACKS
474 #endif
475
476 /* If we're on an a platform on which we can't save call stacks, but    */
477 /* gcc is normally used, we go ahead and define GC_ADD_CALLER.          */
478 /* We make this decision independent of whether gcc is actually being   */
479 /* used, in order to keep the interface consistent, and allow mixing    */
480 /* of compilers.                                                        */
481 /* This may also be desirable if it is possible but expensive to        */
482 /* retrieve the call chain.                                             */
483 #if (defined(__linux__) || defined(__NetBSD__) || defined(__OpenBSD__) \
484      || defined(__FreeBSD__)) & !defined(GC_CAN_SAVE_CALL_STACKS)
485 # define GC_ADD_CALLER
486 # if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) 
487     /* gcc knows how to retrieve return address, but we don't know */
488     /* how to generate call stacks.                                */
489 #   define GC_RETURN_ADDR (GC_word)__builtin_return_address(0)
490 # else
491     /* Just pass 0 for gcc compatibility. */
492 #   define GC_RETURN_ADDR 0
493 # endif
494 #endif
495
496 #ifdef GC_ADD_CALLER
497 #  define GC_EXTRAS GC_RETURN_ADDR, __FILE__, __LINE__
498 #  define GC_EXTRA_PARAMS GC_word ra, GC_CONST char * s, int i
499 #else
500 #  define GC_EXTRAS __FILE__, __LINE__
501 #  define GC_EXTRA_PARAMS GC_CONST char * s, int i
502 #endif
503
504 /* Debugging (annotated) allocation.  GC_gcollect will check            */
505 /* objects allocated in this way for overwrites, etc.                   */
506 GC_API GC_PTR GC_debug_malloc
507         GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
508 GC_API GC_PTR GC_debug_malloc_atomic
509         GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
510 GC_API GC_PTR GC_debug_malloc_uncollectable
511         GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
512 GC_API GC_PTR GC_debug_malloc_stubborn
513         GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
514 GC_API GC_PTR GC_debug_malloc_ignore_off_page
515         GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
516 GC_API GC_PTR GC_debug_malloc_atomic_ignore_off_page
517         GC_PROTO((size_t size_in_bytes, GC_EXTRA_PARAMS));
518 GC_API void GC_debug_free GC_PROTO((GC_PTR object_addr));
519 GC_API GC_PTR GC_debug_realloc
520         GC_PROTO((GC_PTR old_object, size_t new_size_in_bytes,
521                   GC_EXTRA_PARAMS));
522 GC_API void GC_debug_change_stubborn GC_PROTO((GC_PTR));
523 GC_API void GC_debug_end_stubborn_change GC_PROTO((GC_PTR));
524
525 /* Routines that allocate objects with debug information (like the      */
526 /* above), but just fill in dummy file and line number information.     */
527 /* Thus they can serve as drop-in malloc/realloc replacements.  This    */
528 /* can be useful for two reasons:                                       */
529 /* 1) It allows the collector to be built with DBG_HDRS_ALL defined     */
530 /*    even if some allocation calls come from 3rd party libraries       */
531 /*    that can't be recompiled.                                         */
532 /* 2) On some platforms, the file and line information is redundant,    */
533 /*    since it can be reconstructed from a stack trace.  On such        */
534 /*    platforms it may be more convenient not to recompile, e.g. for    */
535 /*    leak detection.  This can be accomplished by instructing the      */
536 /*    linker to replace malloc/realloc with these.                      */
537 GC_API GC_PTR GC_debug_malloc_replacement GC_PROTO((size_t size_in_bytes));
538 GC_API GC_PTR GC_debug_realloc_replacement
539               GC_PROTO((GC_PTR object_addr, size_t size_in_bytes));
540                                  
541 # ifdef GC_DEBUG
542 #   define GC_MALLOC(sz) GC_debug_malloc(sz, GC_EXTRAS)
543 #   define GC_MALLOC_ATOMIC(sz) GC_debug_malloc_atomic(sz, GC_EXTRAS)
544 #   define GC_MALLOC_UNCOLLECTABLE(sz) \
545                         GC_debug_malloc_uncollectable(sz, GC_EXTRAS)
546 #   define GC_MALLOC_IGNORE_OFF_PAGE(sz) \
547                         GC_debug_malloc_ignore_off_page(sz, GC_EXTRAS)
548 #   define GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(sz) \
549                         GC_debug_malloc_atomic_ignore_off_page(sz, GC_EXTRAS)
550 #   define GC_REALLOC(old, sz) GC_debug_realloc(old, sz, GC_EXTRAS)
551 #   define GC_FREE(p) GC_debug_free(p)
552 #   define GC_REGISTER_FINALIZER(p, f, d, of, od) \
553         GC_debug_register_finalizer(p, f, d, of, od)
554 #   define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
555         GC_debug_register_finalizer_ignore_self(p, f, d, of, od)
556 #   define GC_REGISTER_FINALIZER_NO_ORDER(p, f, d, of, od) \
557         GC_debug_register_finalizer_no_order(p, f, d, of, od)
558 #   define GC_MALLOC_STUBBORN(sz) GC_debug_malloc_stubborn(sz, GC_EXTRAS);
559 #   define GC_CHANGE_STUBBORN(p) GC_debug_change_stubborn(p)
560 #   define GC_END_STUBBORN_CHANGE(p) GC_debug_end_stubborn_change(p)
561 #   define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
562         GC_general_register_disappearing_link(link, GC_base(obj))
563 #   define GC_REGISTER_DISPLACEMENT(n) GC_debug_register_displacement(n)
564 # else
565 #   define GC_MALLOC(sz) GC_malloc(sz)
566 #   define GC_MALLOC_ATOMIC(sz) GC_malloc_atomic(sz)
567 #   define GC_MALLOC_UNCOLLECTABLE(sz) GC_malloc_uncollectable(sz)
568 #   define GC_MALLOC_IGNORE_OFF_PAGE(sz) \
569                         GC_malloc_ignore_off_page(sz)
570 #   define GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(sz) \
571                         GC_malloc_atomic_ignore_off_page(sz)
572 #   define GC_REALLOC(old, sz) GC_realloc(old, sz)
573 #   define GC_FREE(p) GC_free(p)
574 #   define GC_REGISTER_FINALIZER(p, f, d, of, od) \
575         GC_register_finalizer(p, f, d, of, od)
576 #   define GC_REGISTER_FINALIZER_IGNORE_SELF(p, f, d, of, od) \
577         GC_register_finalizer_ignore_self(p, f, d, of, od)
578 #   define GC_REGISTER_FINALIZER_NO_ORDER(p, f, d, of, od) \
579         GC_register_finalizer_no_order(p, f, d, of, od)
580 #   define GC_MALLOC_STUBBORN(sz) GC_malloc_stubborn(sz)
581 #   define GC_CHANGE_STUBBORN(p) GC_change_stubborn(p)
582 #   define GC_END_STUBBORN_CHANGE(p) GC_end_stubborn_change(p)
583 #   define GC_GENERAL_REGISTER_DISAPPEARING_LINK(link, obj) \
584         GC_general_register_disappearing_link(link, obj)
585 #   define GC_REGISTER_DISPLACEMENT(n) GC_register_displacement(n)
586 # endif
587 /* The following are included because they are often convenient, and    */
588 /* reduce the chance for a misspecifed size argument.  But calls may    */
589 /* expand to something syntactically incorrect if t is a complicated    */
590 /* type expression.                                                     */
591 # define GC_NEW(t) (t *)GC_MALLOC(sizeof (t))
592 # define GC_NEW_ATOMIC(t) (t *)GC_MALLOC_ATOMIC(sizeof (t))
593 # define GC_NEW_STUBBORN(t) (t *)GC_MALLOC_STUBBORN(sizeof (t))
594 # define GC_NEW_UNCOLLECTABLE(t) (t *)GC_MALLOC_UNCOLLECTABLE(sizeof (t))
595
596 /* Finalization.  Some of these primitives are grossly unsafe.          */
597 /* The idea is to make them both cheap, and sufficient to build         */
598 /* a safer layer, closer to PCedar finalization.                        */
599 /* The interface represents my conclusions from a long discussion       */
600 /* with Alan Demers, Dan Greene, Carl Hauser, Barry Hayes,              */
601 /* Christian Jacobi, and Russ Atkinson.  It's not perfect, and          */
602 /* probably nobody else agrees with it.     Hans-J. Boehm  3/13/92      */
603 typedef void (*GC_finalization_proc)
604         GC_PROTO((GC_PTR obj, GC_PTR client_data));
605
606 GC_API void GC_register_finalizer
607         GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
608                   GC_finalization_proc *ofn, GC_PTR *ocd));
609 GC_API void GC_debug_register_finalizer
610         GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
611                   GC_finalization_proc *ofn, GC_PTR *ocd));
612         /* When obj is no longer accessible, invoke             */
613         /* (*fn)(obj, cd).  If a and b are inaccessible, and    */
614         /* a points to b (after disappearing links have been    */
615         /* made to disappear), then only a will be              */
616         /* finalized.  (If this does not create any new         */
617         /* pointers to b, then b will be finalized after the    */
618         /* next collection.)  Any finalizable object that       */
619         /* is reachable from itself by following one or more    */
620         /* pointers will not be finalized (or collected).       */
621         /* Thus cycles involving finalizable objects should     */
622         /* be avoided, or broken by disappearing links.         */
623         /* All but the last finalizer registered for an object  */
624         /* is ignored.                                          */
625         /* Finalization may be removed by passing 0 as fn.      */
626         /* Finalizers are implicitly unregistered just before   */
627         /* they are invoked.                                    */
628         /* The old finalizer and client data are stored in      */
629         /* *ofn and *ocd.                                       */ 
630         /* Fn is never invoked on an accessible object,         */
631         /* provided hidden pointers are converted to real       */
632         /* pointers only if the allocation lock is held, and    */
633         /* such conversions are not performed by finalization   */
634         /* routines.                                            */
635         /* If GC_register_finalizer is aborted as a result of   */
636         /* a signal, the object may be left with no             */
637         /* finalization, even if neither the old nor new        */
638         /* finalizer were NULL.                                 */
639         /* Obj should be the nonNULL starting address of an     */
640         /* object allocated by GC_malloc or friends.            */
641         /* Note that any garbage collectable object referenced  */
642         /* by cd will be considered accessible until the        */
643         /* finalizer is invoked.                                */
644
645 /* Another versions of the above follow.  It ignores            */
646 /* self-cycles, i.e. pointers from a finalizable object to      */
647 /* itself.  There is a stylistic argument that this is wrong,   */
648 /* but it's unavoidable for C++, since the compiler may         */
649 /* silently introduce these.  It's also benign in that specific */
650 /* case.  And it helps if finalizable objects are split to      */
651 /* avoid cycles.                                                */
652 /* Note that cd will still be viewed as accessible, even if it  */
653 /* refers to the object itself.                                 */
654 GC_API void GC_register_finalizer_ignore_self
655         GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
656                   GC_finalization_proc *ofn, GC_PTR *ocd));
657 GC_API void GC_debug_register_finalizer_ignore_self
658         GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
659                   GC_finalization_proc *ofn, GC_PTR *ocd));
660
661 /* Another version of the above.  It ignores all cycles.        */
662 /* It should probably only be used by Java implementations.     */
663 /* Note that cd will still be viewed as accessible, even if it  */
664 /* refers to the object itself.                                 */
665 GC_API void GC_register_finalizer_no_order
666         GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
667                   GC_finalization_proc *ofn, GC_PTR *ocd));
668 GC_API void GC_debug_register_finalizer_no_order
669         GC_PROTO((GC_PTR obj, GC_finalization_proc fn, GC_PTR cd,
670                   GC_finalization_proc *ofn, GC_PTR *ocd));
671
672
673 /* The following routine may be used to break cycles between    */
674 /* finalizable objects, thus causing cyclic finalizable         */
675 /* objects to be finalized in the correct order.  Standard      */
676 /* use involves calling GC_register_disappearing_link(&p),      */
677 /* where p is a pointer that is not followed by finalization    */
678 /* code, and should not be considered in determining            */
679 /* finalization order.                                          */
680 GC_API int GC_register_disappearing_link GC_PROTO((GC_PTR * /* link */));
681         /* Link should point to a field of a heap allocated     */
682         /* object obj.  *link will be cleared when obj is       */
683         /* found to be inaccessible.  This happens BEFORE any   */
684         /* finalization code is invoked, and BEFORE any         */
685         /* decisions about finalization order are made.         */
686         /* This is useful in telling the finalizer that         */
687         /* some pointers are not essential for proper           */
688         /* finalization.  This may avoid finalization cycles.   */
689         /* Note that obj may be resurrected by another          */
690         /* finalizer, and thus the clearing of *link may        */
691         /* be visible to non-finalization code.                 */
692         /* There's an argument that an arbitrary action should  */
693         /* be allowed here, instead of just clearing a pointer. */
694         /* But this causes problems if that action alters, or   */
695         /* examines connectivity.                               */
696         /* Returns 1 if link was already registered, 0          */
697         /* otherwise.                                           */
698         /* Only exists for backward compatibility.  See below:  */
699         
700 GC_API int GC_general_register_disappearing_link
701         GC_PROTO((GC_PTR * /* link */, GC_PTR obj));
702         /* A slight generalization of the above. *link is       */
703         /* cleared when obj first becomes inaccessible.  This   */
704         /* can be used to implement weak pointers easily and    */
705         /* safely. Typically link will point to a location      */
706         /* holding a disguised pointer to obj.  (A pointer      */
707         /* inside an "atomic" object is effectively             */
708         /* disguised.)   In this way soft                       */
709         /* pointers are broken before any object                */
710         /* reachable from them are finalized.  Each link        */
711         /* May be registered only once, i.e. with one obj       */
712         /* value.  This was added after a long email discussion */
713         /* with John Ellis.                                     */
714         /* Obj must be a pointer to the first word of an object */
715         /* we allocated.  It is unsafe to explicitly deallocate */
716         /* the object containing link.  Explicitly deallocating */
717         /* obj may or may not cause link to eventually be       */
718         /* cleared.                                             */
719 GC_API int GC_unregister_disappearing_link GC_PROTO((GC_PTR * /* link */));
720         /* Returns 0 if link was not actually registered.       */
721         /* Undoes a registration by either of the above two     */
722         /* routines.                                            */
723
724 /* Returns !=0  if GC_invoke_finalizers has something to do.            */
725 GC_API int GC_should_invoke_finalizers GC_PROTO((void));
726
727 GC_API int GC_invoke_finalizers GC_PROTO((void));
728         /* Run finalizers for all objects that are ready to     */
729         /* be finalized.  Return the number of finalizers       */
730         /* that were run.  Normally this is also called         */
731         /* implicitly during some allocations.  If              */
732         /* GC-finalize_on_demand is nonzero, it must be called  */
733         /* explicitly.                                          */
734
735 /* GC_set_warn_proc can be used to redirect or filter warning messages. */
736 /* p may not be a NULL pointer.                                         */
737 typedef void (*GC_warn_proc) GC_PROTO((char *msg, GC_word arg));
738 GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn_proc p));
739     /* Returns old warning procedure.   */
740
741 GC_API GC_word GC_set_free_space_divisor GC_PROTO((GC_word value));
742     /* Set free_space_divisor.  See above for definition.       */
743     /* Returns old value.                                       */
744         
745 /* The following is intended to be used by a higher level       */
746 /* (e.g. Java-like) finalization facility.  It is expected      */
747 /* that finalization code will arrange for hidden pointers to   */
748 /* disappear.  Otherwise objects can be accessed after they     */
749 /* have been collected.                                         */
750 /* Note that putting pointers in atomic objects or in           */
751 /* nonpointer slots of "typed" objects is equivalent to         */
752 /* disguising them in this way, and may have other advantages.  */
753 # if defined(I_HIDE_POINTERS) || defined(GC_I_HIDE_POINTERS)
754     typedef GC_word GC_hidden_pointer;
755 #   define HIDE_POINTER(p) (~(GC_hidden_pointer)(p))
756 #   define REVEAL_POINTER(p) ((GC_PTR)(HIDE_POINTER(p)))
757     /* Converting a hidden pointer to a real pointer requires verifying */
758     /* that the object still exists.  This involves acquiring the       */
759     /* allocator lock to avoid a race with the collector.               */
760 # endif /* I_HIDE_POINTERS */
761
762 typedef GC_PTR (*GC_fn_type) GC_PROTO((GC_PTR client_data));
763 GC_API GC_PTR GC_call_with_alloc_lock
764                 GC_PROTO((GC_fn_type fn, GC_PTR client_data));
765
766 /* The following routines are primarily intended for use with a         */
767 /* preprocessor which inserts calls to check C pointer arithmetic.      */
768
769 /* Check that p and q point to the same object.                 */
770 /* Fail conspicuously if they don't.                            */
771 /* Returns the first argument.                                  */
772 /* Succeeds if neither p nor q points to the heap.              */
773 /* May succeed if both p and q point to between heap objects.   */
774 GC_API GC_PTR GC_same_obj GC_PROTO((GC_PTR p, GC_PTR q));
775
776 /* Checked pointer pre- and post- increment operations.  Note that      */
777 /* the second argument is in units of bytes, not multiples of the       */
778 /* object size.  This should either be invoked from a macro, or the     */
779 /* call should be automatically generated.                              */
780 GC_API GC_PTR GC_pre_incr GC_PROTO((GC_PTR *p, size_t how_much));
781 GC_API GC_PTR GC_post_incr GC_PROTO((GC_PTR *p, size_t how_much));
782
783 /* Check that p is visible                                              */
784 /* to the collector as a possibly pointer containing location.          */
785 /* If it isn't fail conspicuously.                                      */
786 /* Returns the argument in all cases.  May erroneously succeed          */
787 /* in hard cases.  (This is intended for debugging use with             */
788 /* untyped allocations.  The idea is that it should be possible, though */
789 /* slow, to add such a call to all indirect pointer stores.)            */
790 /* Currently useless for multithreaded worlds.                          */
791 GC_API GC_PTR GC_is_visible GC_PROTO((GC_PTR p));
792
793 /* Check that if p is a pointer to a heap page, then it points to       */
794 /* a valid displacement within a heap object.                           */
795 /* Fail conspicuously if this property does not hold.                   */
796 /* Uninteresting with GC_all_interior_pointers.                         */
797 /* Always returns its argument.                                         */
798 GC_API GC_PTR GC_is_valid_displacement GC_PROTO((GC_PTR p));
799
800 /* Safer, but slow, pointer addition.  Probably useful mainly with      */
801 /* a preprocessor.  Useful only for heap pointers.                      */
802 #ifdef GC_DEBUG
803 #   define GC_PTR_ADD3(x, n, type_of_result) \
804         ((type_of_result)GC_same_obj((x)+(n), (x)))
805 #   define GC_PRE_INCR3(x, n, type_of_result) \
806         ((type_of_result)GC_pre_incr(&(x), (n)*sizeof(*x))
807 #   define GC_POST_INCR2(x, type_of_result) \
808         ((type_of_result)GC_post_incr(&(x), sizeof(*x))
809 #   ifdef __GNUC__
810 #       define GC_PTR_ADD(x, n) \
811             GC_PTR_ADD3(x, n, typeof(x))
812 #       define GC_PRE_INCR(x, n) \
813             GC_PRE_INCR3(x, n, typeof(x))
814 #       define GC_POST_INCR(x, n) \
815             GC_POST_INCR3(x, typeof(x))
816 #   else
817         /* We can't do this right without typeof, which ANSI    */
818         /* decided was not sufficiently useful.  Repeatedly     */
819         /* mentioning the arguments seems too dangerous to be   */
820         /* useful.  So does not casting the result.             */
821 #       define GC_PTR_ADD(x, n) ((x)+(n))
822 #   endif
823 #else   /* !GC_DEBUG */
824 #   define GC_PTR_ADD3(x, n, type_of_result) ((x)+(n))
825 #   define GC_PTR_ADD(x, n) ((x)+(n))
826 #   define GC_PRE_INCR3(x, n, type_of_result) ((x) += (n))
827 #   define GC_PRE_INCR(x, n) ((x) += (n))
828 #   define GC_POST_INCR2(x, n, type_of_result) ((x)++)
829 #   define GC_POST_INCR(x, n) ((x)++)
830 #endif
831
832 /* Safer assignment of a pointer to a nonstack location.        */
833 #ifdef GC_DEBUG
834 # ifdef __STDC__
835 #   define GC_PTR_STORE(p, q) \
836         (*(void **)GC_is_visible(p) = GC_is_valid_displacement(q))
837 # else
838 #   define GC_PTR_STORE(p, q) \
839         (*(char **)GC_is_visible(p) = GC_is_valid_displacement(q))
840 # endif
841 #else /* !GC_DEBUG */
842 #   define GC_PTR_STORE(p, q) *((p) = (q))
843 #endif
844
845 /* Fynctions called to report pointer checking errors */
846 GC_API void (*GC_same_obj_print_proc) GC_PROTO((GC_PTR p, GC_PTR q));
847
848 GC_API void (*GC_is_valid_displacement_print_proc)
849         GC_PROTO((GC_PTR p));
850
851 GC_API void (*GC_is_visible_print_proc)
852         GC_PROTO((GC_PTR p));
853
854
855 /* For pthread support, we generally need to intercept a number of      */
856 /* thread library calls.  We do that here by macro defining them.       */
857
858 #if !defined(GC_USE_LD_WRAP) && \
859     (defined(GC_PTHREADS) || defined(GC_SOLARIS_THREADS))
860 # include "gc_pthread_redirects.h"
861 #endif
862
863 # if defined(PCR) || defined(GC_SOLARIS_THREADS) || \
864      defined(GC_PTHREADS) || defined(GC_WIN32_THREADS)
865         /* Any flavor of threads except SRC_M3. */
866 /* This returns a list of objects, linked through their first           */
867 /* word.  Its use can greatly reduce lock contention problems, since    */
868 /* the allocation lock can be acquired and released many fewer times.   */
869 /* lb must be large enough to hold the pointer field.                   */
870 /* It is used internally by gc_local_alloc.h, which provides a simpler  */
871 /* programming interface on Linux.                                      */
872 GC_PTR GC_malloc_many(size_t lb);
873 #define GC_NEXT(p) (*(GC_PTR *)(p))     /* Retrieve the next element    */
874                                         /* in returned list.            */
875 extern void GC_thr_init();      /* Needed for Solaris/X86       */
876
877 #endif /* THREADS && !SRC_M3 */
878
879 #if defined(GC_WIN32_THREADS) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
880 # include <windows.h>
881
882   /*
883    * All threads must be created using GC_CreateThread, so that they will be
884    * recorded in the thread table.  For backwards compatibility, this is not
885    * technically true if the GC is built as a dynamic library, since it can
886    * and does then use DllMain to keep track of thread creations.  But new code
887    * should be built to call GC_CreateThread.
888    */
889   GC_API HANDLE GC_CreateThread(
890       LPSECURITY_ATTRIBUTES lpThreadAttributes,
891       DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
892       LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId );
893
894 # if defined(_WIN32_WCE)
895   /*
896    * win32_threads.c implements the real WinMain, which will start a new thread
897    * to call GC_WinMain after initializing the garbage collector.
898    */
899   int WINAPI GC_WinMain(
900       HINSTANCE hInstance,
901       HINSTANCE hPrevInstance,
902       LPWSTR lpCmdLine,
903       int nCmdShow );
904
905 #  ifndef GC_BUILD
906 #    define WinMain GC_WinMain
907 #    define CreateThread GC_CreateThread
908 #  endif
909 # endif /* defined(_WIN32_WCE) */
910
911 #endif /* defined(GC_WIN32_THREADS)  && !cygwin */
912
913 /*
914  * If you are planning on putting
915  * the collector in a SunOS 5 dynamic library, you need to call GC_INIT()
916  * from the statically loaded program section.
917  * This circumvents a Solaris 2.X (X<=4) linker bug.
918  */
919 #if defined(sparc) || defined(__sparc)
920 #   define GC_INIT() { extern end, etext; \
921                        GC_noop(&end, &etext); }
922 #else
923 # if defined(__CYGWIN32__) && defined(GC_DLL) || defined (_AIX)
924     /*
925      * Similarly gnu-win32 DLLs need explicit initialization from
926      * the main program, as does AIX.
927      */
928 #   define GC_INIT() { GC_add_roots(DATASTART, DATAEND); }
929 # else
930 #  if defined(__APPLE__) && defined(__MACH__)
931 #   define GC_INIT() { GC_init(); }
932 #  else
933 #   define GC_INIT()
934 #  endif
935 # endif
936 #endif
937
938 #if !defined(_WIN32_WCE) \
939     && ((defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
940         || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__))
941   /* win32S may not free all resources on process exit.  */
942   /* This explicitly deallocates the heap.               */
943     GC_API void GC_win32_free_heap ();
944 #endif
945
946 #if ( defined(_AMIGA) && !defined(GC_AMIGA_MAKINGLIB) )
947   /* Allocation really goes through GC_amiga_allocwrapper_do */
948 # include "gc_amiga_redirects.h"
949 #endif
950
951 #if defined(GC_REDIRECT_TO_LOCAL) && !defined(GC_LOCAL_ALLOC_H)
952 #  include  "gc_local_alloc.h"
953 #endif
954
955 #ifdef __cplusplus
956     }  /* end of extern "C" */
957 #endif
958
959 #endif /* _GC_H */