From: ivmai Date: Sun, 13 Mar 2011 12:28:29 +0000 (+0000) Subject: 2011-03-13 Ivan Maidanski X-Git-Tag: gc7_2alpha6~94 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=35260b7ff2dc15a5194758ab6f3c73fbfb40acb3;p=gc 2011-03-13 Ivan Maidanski * finalize.c (GC_register_finalizer_inner): Fix a typo in a comment. *include/private/gcconfig.h (STACKBOTTOM): Ditto. * gcj_mlc.c (GC_core_gcj_malloc): Replace 0/1 with TRUE/FALSE in EXPECT (the 2nd argument). * malloc.c (GC_core_malloc_atomic, GC_core_malloc, GC_free): Ditto. * mark.c (GC_mark_and_push, GC_mark_and_push_stack): Ditto. * thread_local_alloc.c (GC_malloc, GC_malloc_atomic): Ditto. * include/private/gc_hdrs.h (HC_GET_HDR): Ditto. * include/private/gc_priv.h (SMALL_OBJ): Ditto. * include/private/specific.h (getspecific): Ditto. * pthread_support.c (LOCK_STATS): Add a comment. --- diff --git a/ChangeLog b/ChangeLog index 3af29f12..3c3b61df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2011-03-13 Ivan Maidanski + + * finalize.c (GC_register_finalizer_inner): Fix a typo in a + comment. + *include/private/gcconfig.h (STACKBOTTOM): Ditto. + * gcj_mlc.c (GC_core_gcj_malloc): Replace 0/1 with TRUE/FALSE in + EXPECT (the 2nd argument). + * malloc.c (GC_core_malloc_atomic, GC_core_malloc, GC_free): + Ditto. + * mark.c (GC_mark_and_push, GC_mark_and_push_stack): Ditto. + * thread_local_alloc.c (GC_malloc, GC_malloc_atomic): Ditto. + * include/private/gc_hdrs.h (HC_GET_HDR): Ditto. + * include/private/gc_priv.h (SMALL_OBJ): Ditto. + * include/private/specific.h (getspecific): Ditto. + * pthread_support.c (LOCK_STATS): Add a comment. + 2011-03-08 Ivan Maidanski * include/gc_pthread_redirects.h (GC_NO_DLOPEN, diff --git a/finalize.c b/finalize.c index 0683d3bb..165aaa33 100644 --- a/finalize.c +++ b/finalize.c @@ -374,7 +374,7 @@ STATIC void GC_register_finalizer_inner(void * obj, curr_fo = fo_next(curr_fo); } if (EXPECT(new_fo != 0, FALSE)) { - /* new_fo is returned GC_oom_fn(), so fn != 0 and hhdr != 0. */ + /* new_fo is returned by GC_oom_fn(), so fn != 0 and hhdr != 0. */ break; } if (fn == 0) { diff --git a/gcj_mlc.c b/gcj_mlc.c index 7d016962..6c160c49 100644 --- a/gcj_mlc.c +++ b/gcj_mlc.c @@ -169,7 +169,7 @@ static void maybe_finalize(void) opp = &(GC_gcjobjfreelist[lg]); LOCK(); op = *opp; - if(EXPECT(op == 0, 0)) { + if(EXPECT(op == 0, FALSE)) { maybe_finalize(); op = (ptr_t)GENERAL_MALLOC_INNER((word)lb, GC_gcj_kind); if (0 == op) { diff --git a/include/private/gc_hdrs.h b/include/private/gc_hdrs.h index b11365ab..13b5249a 100644 --- a/include/private/gc_hdrs.h +++ b/include/private/gc_hdrs.h @@ -104,7 +104,7 @@ typedef struct hblkhdr hdr; # define HC_GET_HDR(p, hhdr, source, exit_label) \ { \ hdr_cache_entry * hce = HCE(p); \ - if (EXPECT(HCE_VALID_FOR(hce, p), 1)) { \ + if (EXPECT(HCE_VALID_FOR(hce, p), TRUE)) { \ HC_HIT(); \ hhdr = hce -> hce_hdr; \ } else { \ diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index ac169595..3d9bc648 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -685,11 +685,11 @@ GC_EXTERN GC_warn_proc GC_current_warn_proc; # define ROUNDED_UP_GRANULES(n) \ BYTES_TO_GRANULES((n) + (GRANULE_BYTES - 1 + EXTRA_BYTES)) # if MAX_EXTRA_BYTES == 0 -# define SMALL_OBJ(bytes) EXPECT((bytes) <= (MAXOBJBYTES), 1) +# define SMALL_OBJ(bytes) EXPECT((bytes) <= (MAXOBJBYTES), TRUE) # else # define SMALL_OBJ(bytes) \ - (EXPECT((bytes) <= (MAXOBJBYTES - MAX_EXTRA_BYTES), 1) || \ - (bytes) <= (MAXOBJBYTES - EXTRA_BYTES)) + (EXPECT((bytes) <= (MAXOBJBYTES - MAX_EXTRA_BYTES), TRUE) \ + || (bytes) <= MAXOBJBYTES - EXTRA_BYTES) /* This really just tests bytes <= MAXOBJBYTES - EXTRA_BYTES. */ /* But we try to avoid looking up EXTRA_BYTES. */ # endif diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index 02323a5d..06c35d86 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -593,7 +593,7 @@ * If STACKBOTTOM is defined, then it's value will be used directly as the * stack base. If LINUX_STACKBOTTOM is defined, then it will be determined * with a method appropriate for most Linux systems. Currently we look - * first for __libc_stack_end (currently only id USE_LIBC_PRIVATES is + * first for __libc_stack_end (currently only if USE_LIBC_PRIVATES is * defined), and if that fails read it from /proc. (If USE_LIBC_PRIVATES * is not defined and NO_PROC_STAT is defined, we revert to HEURISTIC2.) * If either of the last two macros are defined, then STACKBOTTOM is computed diff --git a/include/private/specific.h b/include/private/specific.h index a404f67b..372238dc 100644 --- a/include/private/specific.h +++ b/include/private/specific.h @@ -84,7 +84,7 @@ GC_INLINE void * PREFIXED(getspecific) (tsd * key) unsigned hash_val = CACHE_HASH(qtid); tse * volatile * entry_ptr = key -> cache + hash_val; tse * entry = *entry_ptr; /* Must be loaded only once. */ - if (EXPECT(entry -> qtid == qtid, 1)) { + if (EXPECT(entry -> qtid == qtid, TRUE)) { GC_ASSERT(entry -> thread == pthread_self()); return entry -> value; } diff --git a/malloc.c b/malloc.c index f6a3f3fd..8109c995 100644 --- a/malloc.c +++ b/malloc.c @@ -182,7 +182,7 @@ GC_API void * GC_CALL GC_generic_malloc(size_t lb, int k) } else { # ifdef THREADS /* Clear any memory that might be used for GC descriptors */ - /* before we release the lock. */ + /* before we release the lock. */ ((word *)result)[0] = 0; ((word *)result)[1] = 0; ((word *)result)[GRANULES_TO_WORDS(lg)-1] = 0; @@ -219,7 +219,7 @@ GC_API void * GC_CALL GC_generic_malloc(size_t lb, int k) lg = GC_size_map[lb]; opp = &(GC_aobjfreelist[lg]); LOCK(); - if( EXPECT((op = *opp) == 0, 0) ) { + if (EXPECT((op = *opp) == 0, FALSE)) { UNLOCK(); return(GENERAL_MALLOC((word)lb, PTRFREE)); } @@ -271,9 +271,9 @@ GC_API char * GC_CALL GC_strdup(const char *s) lg = GC_size_map[lb]; opp = (void **)&(GC_objfreelist[lg]); LOCK(); - if( EXPECT((op = *opp) == 0, 0) ) { + if (EXPECT((op = *opp) == 0, FALSE)) { UNLOCK(); - return(GENERAL_MALLOC((word)lb, NORMAL)); + return (GENERAL_MALLOC((word)lb, NORMAL)); } GC_ASSERT(0 == obj_link(op) || ((word)obj_link(op) @@ -426,7 +426,7 @@ GC_API void GC_CALL GC_free(void * p) ngranules = BYTES_TO_GRANULES(sz); knd = hhdr -> hb_obj_kind; ok = &GC_obj_kinds[knd]; - if (EXPECT((ngranules <= MAXOBJGRANULES), 1)) { + if (EXPECT(ngranules <= MAXOBJGRANULES, TRUE)) { LOCK(); GC_bytes_freed += sz; if (IS_UNCOLLECTABLE(knd)) GC_non_gc_bytes -= sz; diff --git a/mark.c b/mark.c index 19aca979..e69d7dc2 100644 --- a/mark.c +++ b/mark.c @@ -1390,7 +1390,7 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj, PREFETCH(obj); GET_HDR(obj, hhdr); - if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr),FALSE)) { + if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE)) { if (GC_all_interior_pointers) { hhdr = GC_find_header(GC_base(obj)); if (hhdr == 0) { @@ -1402,7 +1402,7 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj, return mark_stack_ptr; } } - if (EXPECT(HBLK_IS_FREE(hhdr),0)) { + if (EXPECT(HBLK_IS_FREE(hhdr), FALSE)) { GC_ADD_TO_BLACK_LIST_NORMAL(obj, (ptr_t)src); return mark_stack_ptr; } @@ -1432,7 +1432,7 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj, PREFETCH(p); GET_HDR(p, hhdr); - if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr),FALSE)) { + if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE)) { if (hhdr != 0) { r = GC_base(p); hhdr = HDR(r); @@ -1442,7 +1442,7 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj, return; } } - if (EXPECT(HBLK_IS_FREE(hhdr),0)) { + if (EXPECT(HBLK_IS_FREE(hhdr), FALSE)) { GC_ADD_TO_BLACK_LIST_NORMAL(p, source); return; } diff --git a/pthread_support.c b/pthread_support.c index d72bb658..2cd012de 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -1601,6 +1601,7 @@ GC_INNER volatile GC_bool GC_collecting = 0; /* explicitly sleep. */ /* #define LOCK_STATS */ +/* Note that LOCK_STATS requires AO_HAVE_test_and_set. */ #ifdef LOCK_STATS AO_t GC_spin_count = 0; AO_t GC_block_count = 0; diff --git a/thread_local_alloc.c b/thread_local_alloc.c index 1e9120d4..2e27331d 100644 --- a/thread_local_alloc.c +++ b/thread_local_alloc.c @@ -139,7 +139,7 @@ GC_API void * GC_CALL GC_malloc(size_t bytes) # if !defined(USE_PTHREAD_SPECIFIC) && !defined(USE_WIN32_SPECIFIC) GC_key_t k = GC_thread_key; - if (EXPECT(0 == k, 0)) { + if (EXPECT(0 == k, FALSE)) { /* We haven't yet run GC_init_parallel. That means */ /* we also aren't locking, so this is fairly cheap. */ return GC_core_malloc(bytes); @@ -149,7 +149,7 @@ GC_API void * GC_CALL GC_malloc(size_t bytes) tsd = GC_getspecific(GC_thread_key); # endif # if defined(USE_PTHREAD_SPECIFIC) || defined(USE_WIN32_SPECIFIC) - if (EXPECT(0 == tsd, 0)) { + if (EXPECT(0 == tsd, FALSE)) { return GC_core_malloc(bytes); } # endif @@ -176,7 +176,7 @@ GC_API void * GC_CALL GC_malloc_atomic(size_t bytes) # if !defined(USE_PTHREAD_SPECIFIC) && !defined(USE_WIN32_SPECIFIC) GC_key_t k = GC_thread_key; - if (EXPECT(0 == k, 0)) { + if (EXPECT(0 == k, FALSE)) { /* We haven't yet run GC_init_parallel. That means */ /* we also aren't locking, so this is fairly cheap. */ return GC_core_malloc(bytes); @@ -186,7 +186,7 @@ GC_API void * GC_CALL GC_malloc_atomic(size_t bytes) tsd = GC_getspecific(GC_thread_key); # endif # if defined(USE_PTHREAD_SPECIFIC) || defined(USE_WIN32_SPECIFIC) - if (EXPECT(0 == tsd, 0)) { + if (EXPECT(0 == tsd, FALSE)) { return GC_core_malloc(bytes); } # endif