]> granicus.if.org Git - gc/commitdiff
2011-03-13 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Sun, 13 Mar 2011 12:28:29 +0000 (12:28 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:56 +0000 (21:06 +0400)
* 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.

ChangeLog
finalize.c
gcj_mlc.c
include/private/gc_hdrs.h
include/private/gc_priv.h
include/private/gcconfig.h
include/private/specific.h
malloc.c
mark.c
pthread_support.c
thread_local_alloc.c

index 3af29f12b78cf61065f8c8568395d2c77980ac10..3c3b61df5552b716723b4e80c2298e88e58813bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2011-03-13  Ivan Maidanski  <ivmai@mail.ru>
+
+       * 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  <ivmai@mail.ru>
 
        * include/gc_pthread_redirects.h (GC_NO_DLOPEN,
index 0683d3bb83f4f9b86d363454830cf58b8fac0a4e..165aaa33aeef1e89433a6a153f2ba6bbbbb80eed 100644 (file)
@@ -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) {
index 7d0169629fc8fe50ae09508a616ad5d64afb9cbb..6c160c498c1439e9518bf02da44d725a82df82a0 100644 (file)
--- 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) {
index b11365ab850f2dd5c8be8ed3c43bcb4d1af38e8d..13b5249a72eb0a9c4971eca6ffc044c332558b84 100644 (file)
@@ -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 { \
index ac169595b687cad2861d30b2ef8c7f5ca5a5fb1e..3d9bc6483b791f0cc3c76ca06ea852cbd2bbdafc 100644 (file)
@@ -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
index 02323a5d99a29378e869c6bde2065b86ca4fabd5..06c35d86d31fc428f8ec44fbf79f275b04309890 100644 (file)
  * 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
index a404f67b4985088c26e057f9e80ea70a031800e1..372238dca56c32b290730629bfd104cac7adafc5 100644 (file)
@@ -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;
     }
index f6a3f3fdedd911ca9cc1035771d8118bd5c5559f..8109c99528ebdbdaa722b480e28d83dc173da1ba 100644 (file)
--- 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 19aca9797b0f6ea2b321643d4546ec9ada68566e..e69d7dc24d58d19d0b3835ec6e2df171ede04174 100644 (file)
--- 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;
     }
index d72bb658b66eb58ecaabdba0dac6d82a26dd61c2..2cd012de885dc1d6e5cfca3832044828a380dee6 100644 (file)
@@ -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;
index 1e9120d46aed53d701db6493925614f39527d114..2e27331dc8a1139c29cc7913685e9222eb5274df 100644 (file)
@@ -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