| 1 | # ifndef GC_H
 | 
|---|
| 2 | #   include "gc.h"
 | 
|---|
| 3 | # endif
 | 
|---|
| 4 | 
 | 
|---|
| 5 | /*
 | 
|---|
| 6 |  * Invoke all remaining finalizers that haven't yet been run.
 | 
|---|
| 7 |  * This is needed for strict compliance with the Java standard, 
 | 
|---|
| 8 |  * which can make the runtime guarantee that all finalizers are run.
 | 
|---|
| 9 |  * This is problematic for several reasons:
 | 
|---|
| 10 |  * 1) It means that finalizers, and all methods calle by them,
 | 
|---|
| 11 |  *    must be prepared to deal with objects that have been finalized in
 | 
|---|
| 12 |  *    spite of the fact that they are still referenced by statically
 | 
|---|
| 13 |  *    allocated pointer variables.
 | 
|---|
| 14 |  * 1) It may mean that we get stuck in an infinite loop running
 | 
|---|
| 15 |  *    finalizers which create new finalizable objects, though that's
 | 
|---|
| 16 |  *    probably unlikely.
 | 
|---|
| 17 |  * Thus this is not recommended for general use.
 | 
|---|
| 18 |  */
 | 
|---|
| 19 | void GC_finalize_all();
 | 
|---|
| 20 | 
 | 
|---|
| 21 | /*
 | 
|---|
| 22 |  * A version of GC_register_finalizer that allows the object to be
 | 
|---|
| 23 |  * finalized before the objects it references.  This is again error
 | 
|---|
| 24 |  * prone, in that it makes it easy to accidentally reference finalized
 | 
|---|
| 25 |  * objects.  Again, recommended only for JVM implementors.
 | 
|---|
| 26 |  */
 | 
|---|
| 27 | void GC_register_finalizer_no_order(GC_PTR obj,
 | 
|---|
| 28 |                                GC_finalization_proc fn, GC_PTR cd,
 | 
|---|
| 29 |                                GC_finalization_proc *ofn, GC_PTR * ocd);
 | 
|---|
| 30 | 
 | 
|---|
| 31 | void GC_debug_register_finalizer_no_order(GC_PTR obj,
 | 
|---|
| 32 |                                GC_finalization_proc fn, GC_PTR cd,
 | 
|---|
| 33 |                                GC_finalization_proc *ofn, GC_PTR * ocd);
 | 
|---|
| 34 | 
 | 
|---|
| 35 | #ifdef GC_DEBUG
 | 
|---|
| 36 | #   define GC_REGISTER_FINALIZER(p, f, d, of, od) \
 | 
|---|
| 37 |         GC_debug_register_finalizer_no_order(p, f, d, of, od)
 | 
|---|
| 38 | #else
 | 
|---|
| 39 | #   define GC_REGISTER_FINALIZER(p, f, d, of, od) \
 | 
|---|
| 40 |         GC_register_finalizer_no_order(p, f, d, of, od)
 | 
|---|
| 41 | #endif
 | 
|---|