From: ivmai Date: Tue, 20 Oct 2009 13:34:26 +0000 (+0000) Subject: 2009-10-20 Ivan Maidanski X-Git-Tag: gc7_2alpha4~29 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cbf2fbfe06d7960b9379cd44eb5ad2016552925b;p=gc 2009-10-20 Ivan Maidanski * include/gc.h (REVEAL_POINTER): Remove redundant parentheses. * include/gc.h (GC_HIDE_POINTER, GC_REVEAL_POINTER): New macros (only if GC_I_HIDE_POINTERS). * backgraph.c (GET_OH_BG_PTR): Prefix REVEAL_POINTER() with "GC_". * dbg_mlc.c (GC_get_back_ptr_info): Ditto. * finalize.c (GC_grow_table, GC_dump_finalization, GC_finalize, GC_enqueue_all_finalizers): Ditto. * backgraph.c (SET_OH_BG_PTR): Prefix HIDE_POINTER() with "GC_". * finalize.c (GC_general_register_disappearing_link, GC_unregister_disappearing_link, GC_register_finalizer_inner, GC_finalize): Ditto. * include/private/dbg_mlc.h (HIDE_BACK_PTR): Ditto. * include/private/dbg_mlc.h (GC_I_HIDE_POINTERS): Define instead of I_HIDE_POINTERS. * include/private/gc_priv.h (GC_I_HIDE_POINTERS): Ditto. * include/gc.h (_GC_H): Strip leading underscore. * include/gc_backptr.h (_GC_H): Ditto. * include/gc_gcj.h (_GC_H): Ditto. * include/gc_mark.h (_GC_H): Ditto. * include/gc_typed.h (_GC_TYPED_H, _GC_H): Ditto. * include/javaxfc.h (_GC_H): Ditto. * include/new_gc_alloc.h (__GC_SPECIALIZE): Ditto. * include/private/dbg_mlc.h (_GC_H): Ditto. * include/private/gc_priv.h (_GC_H): Ditto. * include/gc_backptr.h: Reformat the code (adjust indentation, comment out function parameter names). * include/gc_gcj.h: Ditto. * include/gc_mark.h: Ditto. * include/gc_typed.h: Ditto. * include/javaxfc.h: Ditto. * include/private/dbg_mlc.h: Ditto. * include/private/gc_priv.h: Ditto. --- diff --git a/ChangeLog b/ChangeLog index 233fcaa0..31f48f81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2009-10-20 Ivan Maidanski + + * include/gc.h (REVEAL_POINTER): Remove redundant parentheses. + * include/gc.h (GC_HIDE_POINTER, GC_REVEAL_POINTER): New macros + (only if GC_I_HIDE_POINTERS). + * backgraph.c (GET_OH_BG_PTR): Prefix REVEAL_POINTER() with "GC_". + * dbg_mlc.c (GC_get_back_ptr_info): Ditto. + * finalize.c (GC_grow_table, GC_dump_finalization, GC_finalize, + GC_enqueue_all_finalizers): Ditto. + * backgraph.c (SET_OH_BG_PTR): Prefix HIDE_POINTER() with "GC_". + * finalize.c (GC_general_register_disappearing_link, + GC_unregister_disappearing_link, GC_register_finalizer_inner, + GC_finalize): Ditto. + * include/private/dbg_mlc.h (HIDE_BACK_PTR): Ditto. + * include/private/dbg_mlc.h (GC_I_HIDE_POINTERS): Define instead + of I_HIDE_POINTERS. + * include/private/gc_priv.h (GC_I_HIDE_POINTERS): Ditto. + * include/gc.h (_GC_H): Strip leading underscore. + * include/gc_backptr.h (_GC_H): Ditto. + * include/gc_gcj.h (_GC_H): Ditto. + * include/gc_mark.h (_GC_H): Ditto. + * include/gc_typed.h (_GC_TYPED_H, _GC_H): Ditto. + * include/javaxfc.h (_GC_H): Ditto. + * include/new_gc_alloc.h (__GC_SPECIALIZE): Ditto. + * include/private/dbg_mlc.h (_GC_H): Ditto. + * include/private/gc_priv.h (_GC_H): Ditto. + * include/gc_backptr.h: Reformat the code (adjust indentation, + comment out function parameter names). + * include/gc_gcj.h: Ditto. + * include/gc_mark.h: Ditto. + * include/gc_typed.h: Ditto. + * include/javaxfc.h: Ditto. + * include/private/dbg_mlc.h: Ditto. + * include/private/gc_priv.h: Ditto. + 2009-10-19 Ivan Maidanski * gc_cpp.cc: Include "gc_cpp.h" instead of . diff --git a/backgraph.c b/backgraph.c index 902db90c..97d362e5 100644 --- a/backgraph.c +++ b/backgraph.c @@ -166,8 +166,8 @@ GC_INLINE void pop_in_progress(ptr_t p) } #define GET_OH_BG_PTR(p) \ - (ptr_t)REVEAL_POINTER(((oh *)(p)) -> oh_bg_ptr) -#define SET_OH_BG_PTR(p,q) (((oh *)(p)) -> oh_bg_ptr = HIDE_POINTER(q)) + (ptr_t)GC_REVEAL_POINTER(((oh *)(p)) -> oh_bg_ptr) +#define SET_OH_BG_PTR(p,q) (((oh *)(p)) -> oh_bg_ptr = GC_HIDE_POINTER(q)) /* Execute s once for each predecessor q of p in the points-to graph. */ /* s should be a bracketed statement. We declare q. */ diff --git a/dbg_mlc.c b/dbg_mlc.c index 96a64b73..bbcb44fa 100644 --- a/dbg_mlc.c +++ b/dbg_mlc.c @@ -102,7 +102,7 @@ GC_bool GC_has_other_debug_info(ptr_t p) ptr_t bp; ptr_t bp_base; if (!GC_HAS_DEBUG_INFO((ptr_t) hdr)) return GC_NO_SPACE; - bp = REVEAL_POINTER(hdr -> oh_back_ptr); + bp = GC_REVEAL_POINTER(hdr -> oh_back_ptr); if (MARKED_FOR_FINALIZATION == bp) return GC_FINALIZER_REFD; if (MARKED_FROM_REGISTER == bp) return GC_REFD_FROM_REG; if (NOT_MARKED == bp) return GC_UNREFERENCED; diff --git a/finalize.c b/finalize.c index 51ee3a28..7dae99c1 100644 --- a/finalize.c +++ b/finalize.c @@ -121,7 +121,7 @@ STATIC void GC_grow_table(struct hash_chain_entry ***table, for (i = 0; i < old_size; i++) { p = (*table)[i]; while (p != 0) { - ptr_t real_key = (ptr_t)REVEAL_POINTER(p -> hidden_key); + ptr_t real_key = GC_REVEAL_POINTER(p -> hidden_key); struct hash_chain_entry *next = p -> next; size_t new_hash = HASH3(real_key, new_size, log_new_size); @@ -167,8 +167,8 @@ GC_API int GC_CALL GC_general_register_disappearing_link(void * * link, } index = HASH2(link, log_dl_table_size); for (curr_dl = dl_head[index]; curr_dl != 0; curr_dl = dl_next(curr_dl)) { - if (curr_dl -> dl_hidden_link == HIDE_POINTER(link)) { - curr_dl -> dl_hidden_obj = HIDE_POINTER(obj); + if (curr_dl -> dl_hidden_link == GC_HIDE_POINTER(link)) { + curr_dl -> dl_hidden_obj = GC_HIDE_POINTER(obj); UNLOCK(); return GC_DUPLICATE; } @@ -188,9 +188,10 @@ GC_API int GC_CALL GC_general_register_disappearing_link(void * * link, /* Recalculate index since the table may grow. */ index = HASH2(link, log_dl_table_size); /* Check again that our disappearing link not in the table. */ - for (curr_dl = dl_head[index]; curr_dl != 0; curr_dl = dl_next(curr_dl)) { - if (curr_dl -> dl_hidden_link == HIDE_POINTER(link)) { - curr_dl -> dl_hidden_obj = HIDE_POINTER(obj); + for (curr_dl = dl_head[index]; curr_dl != 0; + curr_dl = dl_next(curr_dl)) { + if (curr_dl -> dl_hidden_link == GC_HIDE_POINTER(link)) { + curr_dl -> dl_hidden_obj = GC_HIDE_POINTER(obj); UNLOCK(); # ifndef DBG_HDRS_ALL /* Free unused new_dl returned by GC_oom_fn() */ @@ -200,8 +201,8 @@ GC_API int GC_CALL GC_general_register_disappearing_link(void * * link, } } } - new_dl -> dl_hidden_obj = HIDE_POINTER(obj); - new_dl -> dl_hidden_link = HIDE_POINTER(link); + new_dl -> dl_hidden_obj = GC_HIDE_POINTER(obj); + new_dl -> dl_hidden_link = GC_HIDE_POINTER(link); dl_set_next(new_dl, dl_head[index]); dl_head[index] = new_dl; GC_dl_entries++; @@ -221,7 +222,7 @@ GC_API int GC_CALL GC_unregister_disappearing_link(void * * link) index = HASH2(link, log_dl_table_size); prev_dl = 0; curr_dl = dl_head[index]; while (curr_dl != 0) { - if (curr_dl -> dl_hidden_link == HIDE_POINTER(link)) { + if (curr_dl -> dl_hidden_link == GC_HIDE_POINTER(link)) { if (prev_dl == 0) { dl_head[index] = dl_next(curr_dl); } else { @@ -329,7 +330,7 @@ STATIC void GC_register_finalizer_inner(void * obj, prev_fo = 0; curr_fo = fo_head[index]; while (curr_fo != 0) { GC_ASSERT(GC_size(curr_fo) >= sizeof(struct finalizable_object)); - if (curr_fo -> fo_hidden_base == HIDE_POINTER(base)) { + if (curr_fo -> fo_hidden_base == GC_HIDE_POINTER(base)) { /* Interruption by a signal in the middle of this */ /* should be safe. The client may see only *ocd */ /* updated, but we'll declare that to be his problem. */ @@ -411,7 +412,7 @@ STATIC void GC_register_finalizer_inner(void * obj, GC_ASSERT(GC_size(new_fo) >= sizeof(struct finalizable_object)); if (ocd) *ocd = 0; if (ofn) *ofn = 0; - new_fo -> fo_hidden_base = (word)HIDE_POINTER(base); + new_fo -> fo_hidden_base = GC_HIDE_POINTER(base); new_fo -> fo_fn = fn; new_fo -> fo_client_data = (ptr_t)cd; new_fo -> fo_object_size = hhdr -> hb_sz; @@ -472,15 +473,15 @@ void GC_dump_finalization(void) GC_printf("Disappearing links:\n"); for (i = 0; i < dl_size; i++) { for (curr_dl = dl_head[i]; curr_dl != 0; curr_dl = dl_next(curr_dl)) { - real_ptr = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_obj); - real_link = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_link); + real_ptr = GC_REVEAL_POINTER(curr_dl -> dl_hidden_obj); + real_link = GC_REVEAL_POINTER(curr_dl -> dl_hidden_link); GC_printf("Object: %p, Link:%p\n", real_ptr, real_link); } } GC_printf("Finalizers:\n"); for (i = 0; i < fo_size; i++) { for (curr_fo = fo_head[i]; curr_fo != 0; curr_fo = fo_next(curr_fo)) { - real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base); + real_ptr = GC_REVEAL_POINTER(curr_fo -> fo_hidden_base); GC_printf("Finalizable object: %p\n", real_ptr); } } @@ -543,8 +544,8 @@ void GC_finalize(void) curr_dl = dl_head[i]; prev_dl = 0; while (curr_dl != 0) { - real_ptr = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_obj); - real_link = (ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_link); + real_ptr = GC_REVEAL_POINTER(curr_dl -> dl_hidden_obj); + real_link = GC_REVEAL_POINTER(curr_dl -> dl_hidden_link); if (!GC_is_marked(real_ptr)) { *(word *)real_link = 0; next_dl = dl_next(curr_dl); @@ -568,7 +569,7 @@ void GC_finalize(void) for (i = 0; i < fo_size; i++) { for (curr_fo = fo_head[i]; curr_fo != 0; curr_fo = fo_next(curr_fo)) { GC_ASSERT(GC_size(curr_fo) >= sizeof(struct finalizable_object)); - real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base); + real_ptr = GC_REVEAL_POINTER(curr_fo -> fo_hidden_base); if (!GC_is_marked(real_ptr)) { GC_MARKED_FOR_FINALIZATION(real_ptr); GC_MARK_FO(real_ptr, curr_fo -> fo_mark_proc); @@ -585,7 +586,7 @@ void GC_finalize(void) curr_fo = fo_head[i]; prev_fo = 0; while (curr_fo != 0) { - real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base); + real_ptr = GC_REVEAL_POINTER(curr_fo -> fo_hidden_base); if (!GC_is_marked(real_ptr)) { if (!GC_java_finalization) { GC_set_mark_bit(real_ptr); @@ -604,7 +605,7 @@ void GC_finalize(void) /* unhide object pointer so any future collections will */ /* see it. */ curr_fo -> fo_hidden_base = - (word) REVEAL_POINTER(curr_fo -> fo_hidden_base); + (word)GC_REVEAL_POINTER(curr_fo -> fo_hidden_base); GC_bytes_finalized += curr_fo -> fo_object_size + sizeof(struct finalizable_object); @@ -651,9 +652,9 @@ void GC_finalize(void) fo_set_next(prev_fo, next_fo); curr_fo -> fo_hidden_base = - (word) HIDE_POINTER(curr_fo -> fo_hidden_base); + GC_HIDE_POINTER(curr_fo -> fo_hidden_base); GC_bytes_finalized -= - curr_fo -> fo_object_size + sizeof(struct finalizable_object); + curr_fo->fo_object_size + sizeof(struct finalizable_object); i = HASH2(real_ptr, log_fo_table_size); fo_set_next (curr_fo, fo_head[i]); @@ -673,7 +674,7 @@ void GC_finalize(void) curr_dl = dl_head[i]; prev_dl = 0; while (curr_dl != 0) { - real_link = GC_base((ptr_t)REVEAL_POINTER(curr_dl -> dl_hidden_link)); + real_link = GC_base(GC_REVEAL_POINTER(curr_dl -> dl_hidden_link)); if (real_link != 0 && !GC_is_marked(real_link)) { next_dl = dl_next(curr_dl); if (prev_dl == 0) { @@ -717,7 +718,7 @@ STATIC void GC_enqueue_all_finalizers(void) curr_fo = fo_head[i]; prev_fo = 0; while (curr_fo != 0) { - real_ptr = (ptr_t)REVEAL_POINTER(curr_fo -> fo_hidden_base); + real_ptr = GC_REVEAL_POINTER(curr_fo -> fo_hidden_base); GC_MARK_FO(real_ptr, GC_normal_finalize_mark_proc); GC_set_mark_bit(real_ptr); @@ -737,8 +738,7 @@ STATIC void GC_enqueue_all_finalizers(void) /* unhide object pointer so any future collections will */ /* see it. */ curr_fo -> fo_hidden_base = - (word) REVEAL_POINTER(curr_fo -> fo_hidden_base); - + (word)GC_REVEAL_POINTER(curr_fo -> fo_hidden_base); GC_bytes_finalized += curr_fo -> fo_object_size + sizeof(struct finalizable_object); curr_fo = next_fo; diff --git a/include/gc.h b/include/gc.h index d1f29298..b5009a07 100644 --- a/include/gc.h +++ b/include/gc.h @@ -27,8 +27,8 @@ * problems. */ -#ifndef _GC_H -#define _GC_H +#ifndef GC_H +#define GC_H #include "gc_version.h" /* Define version numbers here to allow test on build machine */ @@ -979,12 +979,19 @@ GC_API void GC_CALLBACK GC_ignore_warn_proc(char *, GC_word); #if defined(I_HIDE_POINTERS) || defined(GC_I_HIDE_POINTERS) typedef GC_word GC_hidden_pointer; # define HIDE_POINTER(p) (~(GC_hidden_pointer)(p)) -# define REVEAL_POINTER(p) ((void *)(HIDE_POINTER(p))) +# define REVEAL_POINTER(p) ((void *)HIDE_POINTER(p)) /* Converting a hidden pointer to a real pointer requires verifying */ /* that the object still exists. This involves acquiring the */ /* allocator lock to avoid a race with the collector. */ #endif /* I_HIDE_POINTERS */ +/* The GC-prefixed symbols are preferred for new code (I_HIDE_POINTERS, */ +/* HIDE_POINTER and REVEAL_POINTER remain for compatibility). */ +#ifdef GC_I_HIDE_POINTERS +# define GC_HIDE_POINTER(p) HIDE_POINTER(p) +# define GC_REVEAL_POINTER(p) REVEAL_POINTER(p) +#endif + typedef void * (GC_CALLBACK * GC_fn_type)(void * /* client_data */); GC_API void * GC_CALL GC_call_with_alloc_lock(GC_fn_type /* fn */, void * /* client_data */); @@ -1441,4 +1448,4 @@ GC_API void GC_CALL GC_win32_free_heap(void); } /* end of extern "C" */ #endif -#endif /* _GC_H */ +#endif /* GC_H */ diff --git a/include/gc_backptr.h b/include/gc_backptr.h index 1b7ad99b..6256f416 100644 --- a/include/gc_backptr.h +++ b/include/gc_backptr.h @@ -40,13 +40,13 @@ #ifndef GC_BACKPTR_H #define GC_BACKPTR_H -# ifndef _GC_H -# include "gc.h" -# endif +#ifndef GC_H +# include "gc.h" +#endif -# ifdef __cplusplus - extern "C" { -# endif +#ifdef __cplusplus + extern "C" { +#endif /* Store information about the object referencing dest in *base_p */ /* and *offset_p. */ @@ -57,17 +57,19 @@ /* source is heap object ==> *base_p != 0, *offset_p = offset */ /* Returns 1 on success, 0 if source couldn't be determined. */ /* Dest can be any address within a heap object. */ -typedef enum { GC_UNREFERENCED, /* No reference info available. */ - GC_NO_SPACE, /* Dest not allocated with debug alloc */ - GC_REFD_FROM_ROOT, /* Referenced directly by root *base_p */ - GC_REFD_FROM_REG, /* Referenced from a register, i.e. */ - /* a root without an address. */ - GC_REFD_FROM_HEAP, /* Referenced from another heap obj. */ - GC_FINALIZER_REFD /* Finalizable and hence accessible. */ +typedef enum { + GC_UNREFERENCED, /* No reference info available. */ + GC_NO_SPACE, /* Dest not allocated with debug alloc. */ + GC_REFD_FROM_ROOT, /* Referenced directly by root *base_p. */ + GC_REFD_FROM_REG, /* Referenced from a register, i.e. */ + /* a root without an address. */ + GC_REFD_FROM_HEAP, /* Referenced from another heap obj. */ + GC_FINALIZER_REFD /* Finalizable and hence accessible. */ } GC_ref_kind; -GC_API GC_ref_kind GC_CALL GC_get_back_ptr_info(void *dest, void **base_p, - size_t *offset_p); +GC_API GC_ref_kind GC_CALL GC_get_back_ptr_info(void * /* dest */, + void ** /* base_p */, + size_t * /* offset_p */); /* Generate a random heap address. */ /* The resulting address is in the heap, but */ @@ -77,11 +79,11 @@ GC_API void * GC_CALL GC_generate_random_heap_address(void); /* Generate a random address inside a valid marked heap object. */ GC_API void * GC_CALL GC_generate_random_valid_address(void); -/* Force a garbage collection and generate a backtrace from a */ -/* random heap address. */ -/* This uses the GC logging mechanism (GC_printf) to produce */ -/* output. It can often be called from a debugger. The */ -/* source in dbg_mlc.c also serves as a sample client. */ +/* Force a garbage collection and generate a backtrace from a */ +/* random heap address. */ +/* This uses the GC logging mechanism (GC_printf) to produce */ +/* output. It can often be called from a debugger. The */ +/* source in dbg_mlc.c also serves as a sample client. */ GC_API void GC_CALL GC_generate_random_backtrace(void); /* Print a backtrace from a specific address. Used by the */ @@ -89,8 +91,8 @@ GC_API void GC_CALL GC_generate_random_backtrace(void); /* before invocation. */ GC_API void GC_CALL GC_print_backtrace(void *); -# ifdef __cplusplus - } /* end of extern "C" */ -# endif +#ifdef __cplusplus + } /* end of extern "C" */ +#endif #endif /* GC_BACKPTR_H */ diff --git a/include/gc_gcj.h b/include/gc_gcj.h index dab2ef72..78658785 100644 --- a/include/gc_gcj.h +++ b/include/gc_gcj.h @@ -24,7 +24,6 @@ */ #ifndef GC_GCJ_H - #define GC_GCJ_H /* Gcj keeps GC descriptor as second word of vtable. This */ @@ -36,13 +35,13 @@ /* These assumptions allow objects on the free list to be */ /* marked normally. */ -#ifndef _GC_H -# include "gc.h" +#ifndef GC_H +# include "gc.h" #endif -# ifdef __cplusplus - extern "C" { -# endif +#ifdef __cplusplus + extern "C" { +#endif /* The following allocators signal an out of memory condition with */ /* return GC_oom_fn(bytes); */ @@ -95,17 +94,16 @@ GC_API int GC_gcj_kind; GC_API int GC_gcj_debug_kind; -# ifdef GC_DEBUG -# define GC_GCJ_MALLOC(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) -# define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) -# else -# define GC_GCJ_MALLOC(s,d) GC_gcj_malloc(s,d) -# define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) \ - GC_gcj_malloc_ignore_off_page(s,d) -# endif +#ifdef GC_DEBUG +# define GC_GCJ_MALLOC(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) +# define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) GC_debug_gcj_malloc(s,d,GC_EXTRAS) +#else +# define GC_GCJ_MALLOC(s,d) GC_gcj_malloc(s,d) +# define GC_GCJ_MALLOC_IGNORE_OFF_PAGE(s,d) GC_gcj_malloc_ignore_off_page(s,d) +#endif -# ifdef __cplusplus - } /* end of extern "C" */ -# endif +#ifdef __cplusplus + } /* end of extern "C" */ +#endif #endif /* GC_GCJ_H */ diff --git a/include/gc_mark.h b/include/gc_mark.h index 3895e152..e3a09a52 100644 --- a/include/gc_mark.h +++ b/include/gc_mark.h @@ -23,15 +23,15 @@ * collector in subtle ways by using this functionality. */ #ifndef GC_MARK_H -# define GC_MARK_H +#define GC_MARK_H -# ifndef _GC_H -# include "gc.h" -# endif +#ifndef GC_H +# include "gc.h" +#endif -# ifdef __cplusplus - extern "C" { -# endif +#ifdef __cplusplus + extern "C" { +#endif /* A client supplied mark procedure. Returns new mark stack pointer. */ /* Primary effect should be to push new entries on the mark stack. */ @@ -55,20 +55,21 @@ /* free list link field in the first word. Thus mark procedures may */ /* not count on the presence of a type descriptor, and must handle this */ /* case correctly somehow. */ -# define GC_PROC_BYTES 100 +#define GC_PROC_BYTES 100 struct GC_ms_entry; -typedef struct GC_ms_entry * (*GC_mark_proc) ( - GC_word * addr, struct GC_ms_entry * mark_stack_ptr, - struct GC_ms_entry * mark_stack_limit, GC_word env); +typedef struct GC_ms_entry * (*GC_mark_proc)(GC_word * /* addr */, + struct GC_ms_entry * /* mark_stack_ptr */, + struct GC_ms_entry * /* mark_stack_limit */, + GC_word /* env */); -# define GC_LOG_MAX_MARK_PROCS 6 -# define GC_MAX_MARK_PROCS (1 << GC_LOG_MAX_MARK_PROCS) +#define GC_LOG_MAX_MARK_PROCS 6 +#define GC_MAX_MARK_PROCS (1 << GC_LOG_MAX_MARK_PROCS) /* In a few cases it's necessary to assign statically known indices to */ /* certain mark procs. Thus we reserve a few for well known clients. */ /* (This is necessary if mark descriptors are compiler generated.) */ #define GC_RESERVED_MARK_PROCS 8 -# define GC_GCJ_RESERVED_MARK_PROC_INDEX 0 +#define GC_GCJ_RESERVED_MARK_PROC_INDEX 0 /* Object descriptors on mark stack or in objects. Low order two */ /* bits are tags distinguishing among the following 4 possibilities */ @@ -90,7 +91,7 @@ typedef struct GC_ms_entry * (*GC_mark_proc) ( /* pushed on the mark stack by invoking */ /* PROC(descr). ENV(descr) is passed as the */ /* last argument. */ -# define GC_MAKE_PROC(proc_index, env) \ +#define GC_MAKE_PROC(proc_index, env) \ (((((env) << GC_LOG_MAX_MARK_PROCS) \ | (proc_index)) << GC_DS_TAG_BITS) | GC_DS_PROC) #define GC_DS_PER_OBJECT 3 /* The real descriptor is at the */ @@ -136,16 +137,15 @@ GC_API void * GC_greatest_plausible_heap_addr; /* which would tie the client code to a fixed collector version.) */ /* Note that mark procedures should explicitly call FIXUP_POINTER() */ /* if required. */ -GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void * obj, - struct GC_ms_entry * mark_stack_ptr, - struct GC_ms_entry * mark_stack_limit, - void * *src); +GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void * /* obj */, + struct GC_ms_entry * /* mark_stack_ptr */, + struct GC_ms_entry * /* mark_stack_limit */, + void ** /* src */); #define GC_MARK_AND_PUSH(obj, msp, lim, src) \ - (((GC_word)obj >= (GC_word)GC_least_plausible_heap_addr && \ - (GC_word)obj <= (GC_word)GC_greatest_plausible_heap_addr)? \ - GC_mark_and_push(obj, msp, lim, src) : \ - msp) + ((GC_word)(obj) >= (GC_word)GC_least_plausible_heap_addr && \ + (GC_word)(obj) <= (GC_word)GC_greatest_plausible_heap_addr ? \ + GC_mark_and_push(obj, msp, lim, src) : (msp)) GC_API size_t GC_debug_header_size; /* The size of the header added to objects allocated through */ @@ -163,15 +163,15 @@ GC_API void ** GC_CALL GC_new_free_list(void); GC_API void ** GC_CALL GC_new_free_list_inner(void); /* Return a new kind, as specified. */ -GC_API unsigned GC_CALL GC_new_kind(void **free_list, - GC_word mark_descriptor_template, - int add_size_to_descriptor, - int clear_new_objects); +GC_API unsigned GC_CALL GC_new_kind(void ** /* free_list */, + GC_word /* mark_descriptor_template */, + int /* add_size_to_descriptor */, + int /* clear_new_objects */); /* The last two parameters must be zero or one. */ -GC_API unsigned GC_CALL GC_new_kind_inner(void **free_list, - GC_word mark_descriptor_template, - int add_size_to_descriptor, - int clear_new_objects); +GC_API unsigned GC_CALL GC_new_kind_inner(void ** /* free_list */, + GC_word /* mark_descriptor_template */, + int /* add_size_to_descriptor */, + int /* clear_new_objects */); /* Return a new mark procedure identifier, suitable for use as */ /* the first argument in GC_MAKE_PROC. */ @@ -184,9 +184,10 @@ GC_API unsigned GC_CALL GC_new_proc_inner(GC_mark_proc); /* the descriptor is not correct. Even in the single-threaded case, */ /* we need to be sure that cleared objects on a free list don't */ /* cause a GC crash if they are accidentally traced. */ -GC_API void * GC_CALL GC_generic_malloc(size_t lb, int k); +GC_API void * GC_CALL GC_generic_malloc(size_t /* lb */, int /* k */); -typedef void (GC_CALLBACK * GC_describe_type_fn) (void *p, char *out_buf); +typedef void (GC_CALLBACK * GC_describe_type_fn)(void * /* p */, + char * /* out_buf */); /* A procedure which */ /* produces a human-readable */ /* description of the "type" of object */ @@ -198,10 +199,10 @@ typedef void (GC_CALLBACK * GC_describe_type_fn) (void *p, char *out_buf); /* as possible, though we do avoid */ /* invoking them on objects on the */ /* global free list. */ -# define GC_TYPE_DESCR_LEN 40 +#define GC_TYPE_DESCR_LEN 40 -GC_API void GC_CALL GC_register_describe_type_fn(int kind, - GC_describe_type_fn knd); +GC_API void GC_CALL GC_register_describe_type_fn(int /* kind */, + GC_describe_type_fn); /* Register a describe_type function */ /* to be used when printing objects */ /* of a particular kind. */ @@ -210,8 +211,8 @@ GC_API void GC_CALL GC_register_describe_type_fn(int kind, GC_API size_t GC_CALL GC_get_heap_size_inner(void); GC_API size_t GC_CALL GC_get_free_bytes_inner(void); -# ifdef __cplusplus - } /* end of extern "C" */ -# endif +#ifdef __cplusplus + } /* end of extern "C" */ +#endif -#endif /* GC_MARK_H */ +#endif /* GC_MARK_H */ diff --git a/include/gc_typed.h b/include/gc_typed.h index 3c75a9f0..10111cdb 100644 --- a/include/gc_typed.h +++ b/include/gc_typed.h @@ -21,33 +21,35 @@ * of the collector, and is not linked in unless referenced. * This does not currently support GC_DEBUG in any interesting way. */ -/* Boehm, May 19, 1994 2:13 pm PDT */ -#ifndef _GC_TYPED_H -# define _GC_TYPED_H -# ifndef _GC_H -# include "gc.h" -# endif +#ifndef GC_TYPED_H +#define GC_TYPED_H + +#ifndef GC_H +# include "gc.h" +#endif #ifdef __cplusplus extern "C" { #endif + typedef GC_word * GC_bitmap; /* The least significant bit of the first word is one if */ /* the first word in the object may be a pointer. */ -# define GC_WORDSZ (8*sizeof(GC_word)) -# define GC_get_bit(bm, index) \ - (((bm)[index/GC_WORDSZ] >> (index%GC_WORDSZ)) & 1) -# define GC_set_bit(bm, index) \ - (bm)[index/GC_WORDSZ] |= ((GC_word)1 << (index%GC_WORDSZ)) -# define GC_WORD_OFFSET(t, f) (offsetof(t,f)/sizeof(GC_word)) -# define GC_WORD_LEN(t) (sizeof(t)/ sizeof(GC_word)) -# define GC_BITMAP_SIZE(t) ((GC_WORD_LEN(t) + GC_WORDSZ-1)/GC_WORDSZ) +#define GC_WORDSZ (8 * sizeof(GC_word)) +#define GC_get_bit(bm, index) \ + (((bm)[index / GC_WORDSZ] >> (index % GC_WORDSZ)) & 1) +#define GC_set_bit(bm, index) \ + (bm)[index / GC_WORDSZ] |= ((GC_word)1 << (index % GC_WORDSZ)) +#define GC_WORD_OFFSET(t, f) (offsetof(t,f) / sizeof(GC_word)) +#define GC_WORD_LEN(t) (sizeof(t) / sizeof(GC_word)) +#define GC_BITMAP_SIZE(t) ((GC_WORD_LEN(t) + GC_WORDSZ - 1) / GC_WORDSZ) typedef GC_word GC_descr; -GC_API GC_descr GC_CALL GC_make_descriptor(GC_bitmap bm, size_t len); +GC_API GC_descr GC_CALL GC_make_descriptor(GC_bitmap /* bm */, + size_t /* len */); /* Return a type descriptor for the object whose layout */ /* is described by the argument. */ /* The least significant bit of the first word is one */ @@ -74,18 +76,19 @@ GC_API GC_descr GC_CALL GC_make_descriptor(GC_bitmap bm, size_t len); /* ... */ /* T_descr = GC_make_descriptor(T_bitmap, GC_WORD_LEN(T)); */ -GC_API void * GC_CALL GC_malloc_explicitly_typed(size_t size_in_bytes, - GC_descr d); +GC_API void * GC_CALL GC_malloc_explicitly_typed(size_t /* size_in_bytes */, + GC_descr /* d */); /* Allocate an object whose layout is described by d. */ /* The resulting object MAY NOT BE PASSED TO REALLOC. */ /* The returned object is cleared. */ -GC_API void * GC_CALL GC_malloc_explicitly_typed_ignore_off_page - (size_t size_in_bytes, GC_descr d); +GC_API void * GC_CALL GC_malloc_explicitly_typed_ignore_off_page( + size_t /* size_in_bytes */, + GC_descr /* d */); -GC_API void * GC_CALL GC_calloc_explicitly_typed(size_t nelements, - size_t element_size_in_bytes, - GC_descr d); +GC_API void * GC_CALL GC_calloc_explicitly_typed(size_t /* nelements */, + size_t /* element_size_in_bytes */, + GC_descr /* d */); /* Allocate an array of nelements elements, each of the */ /* given size, and with the given descriptor. */ /* The element size must be a multiple of the byte */ @@ -95,17 +98,17 @@ GC_API void * GC_CALL GC_calloc_explicitly_typed(size_t nelements, /* Returned object is cleared. */ #ifdef GC_DEBUG -# define GC_MALLOC_EXPLICITLY_TYPED(bytes, d) GC_MALLOC(bytes) -# define GC_CALLOC_EXPLICITLY_TYPED(n, bytes, d) GC_MALLOC(n*bytes) +# define GC_MALLOC_EXPLICITLY_TYPED(bytes, d) GC_MALLOC(bytes) +# define GC_CALLOC_EXPLICITLY_TYPED(n, bytes, d) GC_MALLOC(n * bytes) #else -# define GC_MALLOC_EXPLICITLY_TYPED(bytes, d) \ - GC_malloc_explicitly_typed(bytes, d) -# define GC_CALLOC_EXPLICITLY_TYPED(n, bytes, d) \ - GC_calloc_explicitly_typed(n, bytes, d) -#endif /* !GC_DEBUG */ +# define GC_MALLOC_EXPLICITLY_TYPED(bytes, d) \ + GC_malloc_explicitly_typed(bytes, d) +# define GC_CALLOC_EXPLICITLY_TYPED(n, bytes, d) \ + GC_calloc_explicitly_typed(n, bytes, d) +#endif #ifdef __cplusplus } /* matches extern "C" */ #endif -#endif /* _GC_TYPED_H */ +#endif /* GC_TYPED_H */ diff --git a/include/javaxfc.h b/include/javaxfc.h index 00ed385d..99eaf9ad 100644 --- a/include/javaxfc.h +++ b/include/javaxfc.h @@ -15,13 +15,13 @@ * modified is included with the above copyright notice. */ -# ifndef _GC_H -# include "gc.h" -# endif +#ifndef GC_H +# include "gc.h" +#endif -# ifdef __cplusplus - extern "C" { -# endif +#ifdef __cplusplus + extern "C" { +#endif /* * Invoke all remaining finalizers that haven't yet been run. (Since the @@ -40,6 +40,6 @@ */ GC_API void GC_CALL GC_finalize_all(void); -# ifdef __cplusplus - } /* end of extern "C" */ -# endif +#ifdef __cplusplus + } /* end of extern "C" */ +#endif diff --git a/include/new_gc_alloc.h b/include/new_gc_alloc.h index 67da7938..4612aeb6 100644 --- a/include/new_gc_alloc.h +++ b/include/new_gc_alloc.h @@ -71,8 +71,6 @@ # define simple_alloc __simple_alloc #endif - - #define GC_ALLOC_H #include @@ -351,45 +349,46 @@ typedef traceable_alloc_template < 0 > traceable_alloc; // even approximate that. The following approximation should work for // SGI compilers, and recent versions of g++. -# define __GC_SPECIALIZE(T,alloc) \ -class simple_alloc { \ -public: \ +// GC_SPECIALIZE() is used internally. +#define GC_SPECIALIZE(T,alloc) \ + class simple_alloc { \ + public: \ static T *allocate(size_t n) \ { return 0 == n? 0 : \ - reinterpret_cast(alloc::ptr_free_allocate(n * sizeof (T))); } \ + reinterpret_cast(alloc::ptr_free_allocate(n * sizeof(T))); } \ static T *allocate(void) \ - { return reinterpret_cast(alloc::ptr_free_allocate(sizeof (T))); } \ + { return reinterpret_cast(alloc::ptr_free_allocate(sizeof(T))); } \ static void deallocate(T *p, size_t n) \ - { if (0 != n) alloc::ptr_free_deallocate(p, n * sizeof (T)); } \ + { if (0 != n) alloc::ptr_free_deallocate(p, n * sizeof(T)); } \ static void deallocate(T *p) \ - { alloc::ptr_free_deallocate(p, sizeof (T)); } \ -}; + { alloc::ptr_free_deallocate(p, sizeof(T)); } \ + }; __STL_BEGIN_NAMESPACE -__GC_SPECIALIZE(char, gc_alloc) -__GC_SPECIALIZE(int, gc_alloc) -__GC_SPECIALIZE(unsigned, gc_alloc) -__GC_SPECIALIZE(float, gc_alloc) -__GC_SPECIALIZE(double, gc_alloc) - -__GC_SPECIALIZE(char, traceable_alloc) -__GC_SPECIALIZE(int, traceable_alloc) -__GC_SPECIALIZE(unsigned, traceable_alloc) -__GC_SPECIALIZE(float, traceable_alloc) -__GC_SPECIALIZE(double, traceable_alloc) - -__GC_SPECIALIZE(char, single_client_gc_alloc) -__GC_SPECIALIZE(int, single_client_gc_alloc) -__GC_SPECIALIZE(unsigned, single_client_gc_alloc) -__GC_SPECIALIZE(float, single_client_gc_alloc) -__GC_SPECIALIZE(double, single_client_gc_alloc) - -__GC_SPECIALIZE(char, single_client_traceable_alloc) -__GC_SPECIALIZE(int, single_client_traceable_alloc) -__GC_SPECIALIZE(unsigned, single_client_traceable_alloc) -__GC_SPECIALIZE(float, single_client_traceable_alloc) -__GC_SPECIALIZE(double, single_client_traceable_alloc) +GC_SPECIALIZE(char, gc_alloc) +GC_SPECIALIZE(int, gc_alloc) +GC_SPECIALIZE(unsigned, gc_alloc) +GC_SPECIALIZE(float, gc_alloc) +GC_SPECIALIZE(double, gc_alloc) + +GC_SPECIALIZE(char, traceable_alloc) +GC_SPECIALIZE(int, traceable_alloc) +GC_SPECIALIZE(unsigned, traceable_alloc) +GC_SPECIALIZE(float, traceable_alloc) +GC_SPECIALIZE(double, traceable_alloc) + +GC_SPECIALIZE(char, single_client_gc_alloc) +GC_SPECIALIZE(int, single_client_gc_alloc) +GC_SPECIALIZE(unsigned, single_client_gc_alloc) +GC_SPECIALIZE(float, single_client_gc_alloc) +GC_SPECIALIZE(double, single_client_gc_alloc) + +GC_SPECIALIZE(char, single_client_traceable_alloc) +GC_SPECIALIZE(int, single_client_traceable_alloc) +GC_SPECIALIZE(unsigned, single_client_traceable_alloc) +GC_SPECIALIZE(float, single_client_traceable_alloc) +GC_SPECIALIZE(double, single_client_traceable_alloc) __STL_END_NAMESPACE diff --git a/include/private/dbg_mlc.h b/include/private/dbg_mlc.h index 684ec3f6..42d25347 100644 --- a/include/private/dbg_mlc.h +++ b/include/private/dbg_mlc.h @@ -73,9 +73,9 @@ typedef struct { /* We're careful never to overwrite a value with lsb 0. */ # if ALIGNMENT == 1 /* Fudge back pointer to be even. */ -# define HIDE_BACK_PTR(p) HIDE_POINTER(~1 & (GC_word)(p)) +# define HIDE_BACK_PTR(p) GC_HIDE_POINTER(~1 & (GC_word)(p)) # else -# define HIDE_BACK_PTR(p) HIDE_POINTER(p) +# define HIDE_BACK_PTR(p) GC_HIDE_POINTER(p) # endif # ifdef KEEP_BACK_PTRS diff --git a/include/private/gc_pmark.h b/include/private/gc_pmark.h index 12e3a249..83aa2ea9 100644 --- a/include/private/gc_pmark.h +++ b/include/private/gc_pmark.h @@ -20,28 +20,30 @@ * routines. Transitively include gc_priv.h. */ #ifndef GC_PMARK_H -# define GC_PMARK_H +#define GC_PMARK_H -# ifdef HAVE_CONFIG_H -# include "private/config.h" -# endif +#ifdef HAVE_CONFIG_H +# include "private/config.h" +#endif -# ifndef GC_BUILD -# define GC_BUILD -# endif +#ifndef GC_BUILD +# define GC_BUILD +#endif -# if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST) -# include "dbg_mlc.h" -# endif -# ifndef GC_MARK_H -# ifndef _GC_H -# define I_HIDE_POINTERS /* to get HIDE_POINTER() and friends */ -# endif -# include "../gc_mark.h" -# endif -# ifndef GC_PRIVATE_H -# include "gc_priv.h" +#if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST) +# include "dbg_mlc.h" +#endif + +#ifndef GC_MARK_H +# ifndef GC_H +# define GC_I_HIDE_POINTERS /* to get GC_HIDE_POINTER() and friends */ # endif +# include "../gc_mark.h" +#endif + +#ifndef GC_PRIVATE_H +# include "gc_priv.h" +#endif /* The real declarations of the following is in gc_priv.h, so that */ /* we can avoid scanning the following table. */ @@ -50,20 +52,20 @@ mark_proc GC_mark_procs[MAX_MARK_PROCS]; */ #ifndef MARK_DESCR_OFFSET -# define MARK_DESCR_OFFSET sizeof(word) +# define MARK_DESCR_OFFSET sizeof(word) #endif /* * Mark descriptor stuff that should remain private for now, mostly * because it's hard to export WORDSZ without including gcconfig.h. */ -# define BITMAP_BITS (WORDSZ - GC_DS_TAG_BITS) -# define PROC(descr) \ - (GC_mark_procs[((descr) >> GC_DS_TAG_BITS) & (GC_MAX_MARK_PROCS-1)]) -# define ENV(descr) \ - ((descr) >> (GC_DS_TAG_BITS + GC_LOG_MAX_MARK_PROCS)) -# define MAX_ENV \ - (((word)1 << (WORDSZ - GC_DS_TAG_BITS - GC_LOG_MAX_MARK_PROCS)) - 1) +#define BITMAP_BITS (WORDSZ - GC_DS_TAG_BITS) +#define PROC(descr) \ + (GC_mark_procs[((descr) >> GC_DS_TAG_BITS) & (GC_MAX_MARK_PROCS-1)]) +#define ENV(descr) \ + ((descr) >> (GC_DS_TAG_BITS + GC_LOG_MAX_MARK_PROCS)) +#define MAX_ENV \ + (((word)1 << (WORDSZ - GC_DS_TAG_BITS - GC_LOG_MAX_MARK_PROCS)) - 1) GC_EXTERN unsigned GC_n_mark_procs; @@ -71,7 +73,7 @@ GC_EXTERN unsigned GC_n_mark_procs; #define GC_MARK_STACK_DISCARDS (INITIAL_MARK_STACK_SIZE/8) typedef struct GC_ms_entry { - ptr_t mse_start; /* First word of object, word aligned */ + ptr_t mse_start; /* First word of object, word aligned. */ GC_word mse_descr; /* Descriptor; low order two bits are tags, */ /* as described in gc_mark.h. */ } mse; @@ -135,7 +137,7 @@ mse * GC_signal_mark_stack_overflow(mse *msp); /* Push the object obj with corresponding heap block header hhdr onto */ /* the mark stack. */ -# define PUSH_OBJ(obj, hhdr, mark_stack_top, mark_stack_limit) \ +#define PUSH_OBJ(obj, hhdr, mark_stack_top, mark_stack_limit) \ { \ register word _descr = (hhdr) -> hb_descr; \ \ @@ -154,8 +156,8 @@ mse * GC_signal_mark_stack_overflow(mse *msp); /* ptr to a currently unmarked object. Mark it. */ /* If we assumed a standard-conforming compiler, we could probably */ /* generate the exit_label transparently. */ -# define PUSH_CONTENTS(current, mark_stack_top, mark_stack_limit, \ - source, exit_label) \ +#define PUSH_CONTENTS(current, mark_stack_top, mark_stack_limit, \ + source, exit_label) \ { \ hdr * my_hhdr; \ \ @@ -167,11 +169,11 @@ exit_label: ; \ /* Set mark bit, exit if it was already set. */ -# ifdef USE_MARK_BITS -# ifdef PARALLEL_MARK - /* The following may fail to exit even if the bit was already set. */ - /* For our uses, that's benign: */ -# define OR_WORD_EXIT_IF_SET(addr, bits, exit_label) \ +#ifdef USE_MARK_BITS +# ifdef PARALLEL_MARK + /* The following may fail to exit even if the bit was already set. */ + /* For our uses, that's benign: */ +# define OR_WORD_EXIT_IF_SET(addr, bits, exit_label) \ { \ if (!(*(addr) & (bits))) { \ AO_or((AO_t *)(addr), (bits)); \ @@ -179,37 +181,36 @@ exit_label: ; \ goto exit_label; \ } \ } -# else -# define OR_WORD_EXIT_IF_SET(addr, bits, exit_label) \ +# else +# define OR_WORD_EXIT_IF_SET(addr, bits, exit_label) \ { \ word old = *(addr); \ word my_bits = (bits); \ if (old & my_bits) goto exit_label; \ *(addr) = (old | my_bits); \ } -# endif /* !PARALLEL_MARK */ -# define SET_MARK_BIT_EXIT_IF_SET(hhdr,bit_no,exit_label) \ +# endif /* !PARALLEL_MARK */ +# define SET_MARK_BIT_EXIT_IF_SET(hhdr,bit_no,exit_label) \ { \ word * mark_word_addr = hhdr -> hb_marks + divWORDSZ(bit_no); \ \ OR_WORD_EXIT_IF_SET(mark_word_addr, (word)1 << modWORDSZ(bit_no), \ exit_label); \ } -# endif - +#endif -# if defined(I386) && defined(__GNUC__) -# define LONG_MULT(hprod, lprod, x, y) { \ +#if defined(I386) && defined(__GNUC__) +# define LONG_MULT(hprod, lprod, x, y) { \ asm("mull %2" : "=a"(lprod), "=d"(hprod) : "g"(y), "0"(x)); \ - } -# else /* No in-line X86 assembly code */ -# define LONG_MULT(hprod, lprod, x, y) { \ + } +#else /* No in-line X86 assembly code */ +# define LONG_MULT(hprod, lprod, x, y) { \ unsigned long long prod = (unsigned long long)x \ * (unsigned long long)y; \ hprod = prod >> 32; \ lprod = (unsigned32)prod; \ - } -# endif + } +#endif #ifdef USE_MARK_BYTES /* There is a race here, and we may set */ @@ -241,6 +242,7 @@ exit_label: ; \ # define TRACE(source, cmd) # define TRACE_TARGET(source, cmd) #endif + /* If the mark bit corresponding to current is not set, set it, and */ /* push the contents of the object on the mark stack. Current points */ /* to the beginning of the object. We rely on the fact that the */ @@ -371,10 +373,10 @@ exit_label: ; \ #endif /* MARK_BIT_PER_OBJ */ #if defined(PRINT_BLACK_LIST) || defined(KEEP_BACK_PTRS) -# define PUSH_ONE_CHECKED_STACK(p, source) \ +# define PUSH_ONE_CHECKED_STACK(p, source) \ GC_mark_and_push_stack((ptr_t)(p), (ptr_t)(source)) #else -# define PUSH_ONE_CHECKED_STACK(p, source) \ +# define PUSH_ONE_CHECKED_STACK(p, source) \ GC_mark_and_push_stack((ptr_t)(p)) #endif @@ -386,9 +388,9 @@ exit_label: ; \ * if the mark stack overflows. */ -# if NEED_FIXUP_POINTER +#if NEED_FIXUP_POINTER /* Try both the raw version and the fixed up one. */ -# define GC_PUSH_ONE_STACK(p, source) \ +# define GC_PUSH_ONE_STACK(p, source) \ if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr \ && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) { \ PUSH_ONE_CHECKED_STACK(p, source); \ @@ -398,20 +400,20 @@ exit_label: ; \ && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) { \ PUSH_ONE_CHECKED_STACK(p, source); \ } -# else /* !NEED_FIXUP_POINTER */ -# define GC_PUSH_ONE_STACK(p, source) \ +#else /* !NEED_FIXUP_POINTER */ +# define GC_PUSH_ONE_STACK(p, source) \ if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr \ && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) { \ PUSH_ONE_CHECKED_STACK(p, source); \ } -# endif +#endif /* * As above, but interior pointer recognition as for * normal heap pointers. */ -# define GC_PUSH_ONE_HEAP(p,source) \ +#define GC_PUSH_ONE_HEAP(p,source) \ FIXUP_POINTER(p); \ if ((ptr_t)(p) >= (ptr_t)GC_least_plausible_heap_addr \ && (ptr_t)(p) < (ptr_t)GC_greatest_plausible_heap_addr) { \ @@ -440,7 +442,7 @@ mse * GC_mark_from(mse * top, mse * bottom, mse *limit); * mutator needs the allocation lock to reveal hidden pointers. * FIXME: Why do we need the GC_mark_state test below? */ -# define GC_MARK_FO(real_ptr, mark_proc) \ +#define GC_MARK_FO(real_ptr, mark_proc) \ { \ (*(mark_proc))(real_ptr); \ while (!GC_mark_stack_empty()) MARK_FROM_MARK_STACK(); \ @@ -470,29 +472,28 @@ typedef int mark_state_t; /* Current state of marking, as follows:*/ /* or a pointer to q appears in a range */ /* on the mark stack. */ -# define MS_NONE 0 /* No marking in progress. I holds. */ +#define MS_NONE 0 /* No marking in progress. I holds. */ /* Mark stack is empty. */ -# define MS_PUSH_RESCUERS 1 /* Rescuing objects are currently */ +#define MS_PUSH_RESCUERS 1 /* Rescuing objects are currently */ /* being pushed. I holds, except */ /* that grungy roots may point to */ /* unmarked objects, as may marked */ /* grungy objects above scan_ptr. */ -# define MS_PUSH_UNCOLLECTABLE 2 - /* I holds, except that marked */ +#define MS_PUSH_UNCOLLECTABLE 2 /* I holds, except that marked */ /* uncollectable objects above scan_ptr */ /* may point to unmarked objects. */ /* Roots may point to unmarked objects */ -# define MS_ROOTS_PUSHED 3 /* I holds, mark stack may be nonempty */ +#define MS_ROOTS_PUSHED 3 /* I holds, mark stack may be nonempty */ -# define MS_PARTIALLY_INVALID 4 /* I may not hold, e.g. because of M.S. */ +#define MS_PARTIALLY_INVALID 4 /* I may not hold, e.g. because of M.S. */ /* overflow. However marked heap */ /* objects below scan_ptr point to */ /* marked or stacked objects. */ -# define MS_INVALID 5 /* I may not hold. */ +#define MS_INVALID 5 /* I may not hold. */ GC_EXTERN mark_state_t GC_mark_state; diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 51fc456b..0cb6fc2b 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -15,52 +15,52 @@ * modified is included with the above copyright notice. */ -# ifndef GC_PRIVATE_H -# define GC_PRIVATE_H +#ifndef GC_PRIVATE_H +#define GC_PRIVATE_H -# ifdef HAVE_CONFIG_H -# include "private/config.h" -# endif +#ifdef HAVE_CONFIG_H +# include "private/config.h" +#endif -# ifndef GC_BUILD -# define GC_BUILD -# endif +#ifndef GC_BUILD +# define GC_BUILD +#endif -# include -# if !(defined( sony_news ) ) -# include -# endif +#include +#if !defined(sony_news) +# include +#endif #ifdef DGUX -# include -# include -# include +# include +# include +# include #endif /* DGUX */ #ifdef BSD_TIME -# include -# include -# include +# include +# include +# include #endif /* BSD_TIME */ #ifdef PARALLEL_MARK -# define AO_REQUIRE_CAS -# if !defined(__GNUC__) && !defined(AO_ASSUME_WINDOWS98) -# define AO_ASSUME_WINDOWS98 -# endif +# define AO_REQUIRE_CAS +# if !defined(__GNUC__) && !defined(AO_ASSUME_WINDOWS98) +# define AO_ASSUME_WINDOWS98 +# endif #endif -#ifndef _GC_H -# define I_HIDE_POINTERS /* to get HIDE_POINTER() and friends */ -# include "../gc.h" +#ifndef GC_H +# define GC_I_HIDE_POINTERS /* to get GC_HIDE_POINTER() and friends */ +# include "../gc.h" #endif #ifndef GC_TINY_FL_H -# include "../gc_tiny_fl.h" +# include "../gc_tiny_fl.h" #endif #ifndef GC_MARK_H -# include "../gc_mark.h" +# include "../gc_mark.h" #endif typedef GC_word word; @@ -68,8 +68,8 @@ typedef GC_signed_word signed_word; typedef unsigned int unsigned32; typedef int GC_bool; -# define TRUE 1 -# define FALSE 0 +#define TRUE 1 +#define FALSE 0 typedef char * ptr_t; /* A generic pointer to which we can add */ /* byte displacements and which can be used */ @@ -131,9 +131,9 @@ typedef char * ptr_t; /* A generic pointer to which we can add */ # define GC_API_PRIV GC_API #endif -# ifndef GC_LOCKS_H -# include "gc_locks.h" -# endif +#ifndef GC_LOCKS_H +# include "gc_locks.h" +#endif # ifdef STACK_GROWS_DOWN # define COOLER_THAN >