Back to index

plt-scheme  4.2.1
sgc.h
Go to the documentation of this file.
00001 
00002 # ifdef __cplusplus
00003 extern "C" {
00004 # endif
00005 
00006 #include <stddef.h>
00007 
00008 #define GC_PTR void*
00009 
00010 void GC_add_roots(void *start, void *end);
00011 
00012 extern void (*GC_start_collect_callback)(void);
00013 extern void (*GC_end_collect_callback)(void);
00014 extern void (*GC_custom_finalize)(void);
00015 extern void (*GC_out_of_memory)(void);
00016 
00017 extern void *GC_initial_trace_root;
00018 extern int (*GC_inital_root_skip)(void *, size_t);
00019 
00020 void GC_set_stack_base(void *base);
00021 void *GC_get_stack_base(void);
00022 
00023 void *GC_base(void *);
00024 
00025 void GC_dump(void);
00026 
00027 long GC_get_memory_use();
00028 
00029 void GC_end_stubborn_change(void *);
00030 
00031 void GC_gcollect(void);
00032 
00033 void *GC_malloc(size_t size_in_bytes);
00034 void *GC_malloc_atomic(size_t size_in_bytes);
00035 void *GC_malloc_stubborn(size_t size_in_bytes);
00036 void *GC_malloc_uncollectable(size_t size_in_bytes);
00037 void *GC_malloc_atomic_uncollectable(size_t size_in_bytes);
00038 
00039 typedef void (*GC_collect_start_callback_Proc)(void);
00040 typedef void (*GC_collect_end_callback_Proc)(void);
00041 GC_collect_start_callback_Proc GC_set_collect_start_callback(GC_collect_start_callback_Proc);
00042 GC_collect_end_callback_Proc GC_set_collect_end_callback(GC_collect_end_callback_Proc);
00043 
00044 void GC_free(void *); /* ... but only if it's turned on in sgc.c. */
00045 
00046 struct GC_Set;
00047 void *GC_malloc_specific(size_t size, struct GC_Set *set);
00048 
00049 void GC_general_register_disappearing_link(void **p, void *a);
00050 void GC_register_late_disappearing_link(void **p, void *a);
00051 void GC_unregister_disappearing_link(void **p);
00052 
00053 void GC_register_finalizer(void *p, void (*f)(void *p, void *data), 
00054                         void *data, void (**oldf)(void *p, void *data), 
00055                         void **olddata);
00056 void GC_register_finalizer_ignore_self(void *p, void (*f)(void *p, void *data), 
00057                                    void *data, void (**oldf)(void *p, void *data), 
00058                                    void **olddata);
00059 void GC_register_eager_finalizer(void *p, int level, void (*f)(void *p, void *data), 
00060                              void *data, void (**oldf)(void *p, void *data), 
00061                              void **olddata);
00062 
00063 typedef void (*GC_count_tracer)(void *v, int);
00064 typedef void (*GC_path_tracer)(void *v, unsigned long src, void *pdata);
00065 typedef void (*GC_trace_init)(void);
00066 typedef void (*GC_trace_done)(void);
00067 typedef void (*GC_set_elem_finalizer)(void *p);
00068 
00069 #define SGC_ATOMIC_SET 1
00070 #define SGC_UNCOLLECTABLE_SET 2
00071 struct GC_Set *GC_new_set(char *name, 
00072                        GC_trace_init init,
00073                        GC_trace_init done,
00074                        GC_count_tracer count_tracer,
00075                        GC_path_tracer path_tracer,
00076                        GC_set_elem_finalizer final,
00077                        int flags);
00078 
00079 struct GC_Set *GC_set(void *d);
00080 
00081 void GC_for_each_element(struct GC_Set *set,
00082                       void (*f)(void *p, int size, void *data),
00083                       void *data);
00084 
00085 int GC_trace_count(int *stack, int *roots, int *uncollectable, int *final);
00086 void GC_trace_path(void);
00087 
00088 void GC_store_path(void *v, unsigned long src, void *path_data);
00089 void **GC_get_next_path(void **prev, int *len);
00090 void GC_clear_paths();
00091 
00092 # ifdef __cplusplus
00093 };
00094 # endif