~ubuntu-branches/ubuntu/quantal/libgc/quantal

« back to all changes in this revision

Viewing changes to include/gc_mark.h

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2011-02-19 12:19:56 UTC
  • mfrom: (1.3.2 upstream) (0.1.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20110219121956-67rb69xlt5nud3v2
Tags: 1:7.1-5
Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
/* case correctly somehow.                                              */
54
54
# define GC_PROC_BYTES 100
55
55
struct GC_ms_entry;
56
 
typedef struct GC_ms_entry * (*GC_mark_proc) GC_PROTO((
 
56
typedef struct GC_ms_entry * (*GC_mark_proc) (
57
57
                GC_word * addr, struct GC_ms_entry * mark_stack_ptr,
58
 
                struct GC_ms_entry * mark_stack_limit, GC_word env));
 
58
                struct GC_ms_entry * mark_stack_limit, GC_word env);
59
59
 
60
60
# define GC_LOG_MAX_MARK_PROCS 6
61
61
# define GC_MAX_MARK_PROCS (1 << GC_LOG_MAX_MARK_PROCS)
106
106
                        /* held.                                        */
107
107
#define GC_INDIR_PER_OBJ_BIAS 0x10
108
108
                        
109
 
extern GC_PTR GC_least_plausible_heap_addr;
110
 
extern GC_PTR GC_greatest_plausible_heap_addr;
 
109
extern void * GC_least_plausible_heap_addr;
 
110
extern void * GC_greatest_plausible_heap_addr;
111
111
                        /* Bounds on the heap.  Guaranteed valid        */
112
112
                        /* Likely to include future heap expansion.     */
113
113
 
130
130
/* which would tie the client code to a fixed collector version.)       */
131
131
/* Note that mark procedures should explicitly call FIXUP_POINTER()     */
132
132
/* if required.                                                         */
133
 
struct GC_ms_entry *GC_mark_and_push
134
 
                GC_PROTO((GC_PTR obj,
135
 
                          struct GC_ms_entry * mark_stack_ptr,
136
 
                          struct GC_ms_entry * mark_stack_limit, GC_PTR *src));
 
133
struct GC_ms_entry *GC_mark_and_push(void * obj,
 
134
                                     struct GC_ms_entry * mark_stack_ptr,
 
135
                                     struct GC_ms_entry * mark_stack_limit,
 
136
                                     void * *src);
137
137
 
138
138
#define GC_MARK_AND_PUSH(obj, msp, lim, src) \
139
139
        (((GC_word)obj >= (GC_word)GC_least_plausible_heap_addr && \
146
146
       /* the GC_debug routines.                                       */
147
147
       /* Defined as a variable so that client mark procedures don't   */
148
148
       /* need to be recompiled for collector version changes.         */
149
 
#define GC_USR_PTR_FROM_BASE(p) ((GC_PTR)((char *)(p) + GC_debug_header_size))
 
149
#define GC_USR_PTR_FROM_BASE(p) ((void *)((char *)(p) + GC_debug_header_size))
150
150
 
151
151
/* And some routines to support creation of new "kinds", e.g. with      */
152
152
/* custom mark procedures, by language runtimes.                        */
153
153
/* The _inner versions assume the caller holds the allocation lock.     */
154
154
 
155
155
/* Return a new free list array.        */
156
 
void ** GC_new_free_list GC_PROTO((void));
157
 
void ** GC_new_free_list_inner GC_PROTO((void));
 
156
void ** GC_new_free_list(void);
 
157
void ** GC_new_free_list_inner(void);
158
158
 
159
159
/* Return a new kind, as specified. */
160
 
int GC_new_kind GC_PROTO((void **free_list, GC_word mark_descriptor_template,
161
 
                          int add_size_to_descriptor, int clear_new_objects));
 
160
unsigned GC_new_kind(void **free_list, GC_word mark_descriptor_template,
 
161
                int add_size_to_descriptor, int clear_new_objects);
162
162
                /* The last two parameters must be zero or one. */
163
 
int GC_new_kind_inner GC_PROTO((void **free_list,
164
 
                                GC_word mark_descriptor_template,
165
 
                                int add_size_to_descriptor,
166
 
                                int clear_new_objects));
 
163
unsigned GC_new_kind_inner(void **free_list,
 
164
                      GC_word mark_descriptor_template,
 
165
                      int add_size_to_descriptor,
 
166
                      int clear_new_objects);
167
167
 
168
168
/* Return a new mark procedure identifier, suitable for use as  */
169
169
/* the first argument in GC_MAKE_PROC.                          */
170
 
int GC_new_proc GC_PROTO((GC_mark_proc));
171
 
int GC_new_proc_inner GC_PROTO((GC_mark_proc));
 
170
unsigned GC_new_proc(GC_mark_proc);
 
171
unsigned GC_new_proc_inner(GC_mark_proc);
172
172
 
173
173
/* Allocate an object of a given kind.  Note that in multithreaded      */
174
174
/* contexts, this is usually unsafe for kinds that have the descriptor  */
176
176
/* the descriptor is not correct.  Even in the single-threaded case,    */
177
177
/* we need to be sure that cleared objects on a free list don't         */
178
178
/* cause a GC crash if they are accidentally traced.                    */
179
 
/* ptr_t */char * GC_generic_malloc GC_PROTO((GC_word lb, int k));
180
 
 
181
 
/* FIXME - Should return void *, but that requires other changes.       */
182
 
 
183
 
typedef void (*GC_describe_type_fn) GC_PROTO((void *p, char *out_buf));
 
179
void * GC_generic_malloc(size_t lb, int k);
 
180
 
 
181
typedef void (*GC_describe_type_fn) (void *p, char *out_buf);
184
182
                                /* A procedure which                    */
185
183
                                /* produces a human-readable            */
186
184
                                /* description of the "type" of object  */
194
192
                                /* global free list.                    */
195
193
#       define GC_TYPE_DESCR_LEN 40
196
194
 
197
 
void GC_register_describe_type_fn GC_PROTO((int kind, GC_describe_type_fn knd));
 
195
void GC_register_describe_type_fn(int kind, GC_describe_type_fn knd);
198
196
                                /* Register a describe_type function    */
199
197
                                /* to be used when printing objects     */
200
198
                                /* of a particular kind.                */