]> granicus.if.org Git - gc/commitdiff
2009-02-28 Hans Boehm <Hans.Boehm@hp.com> (Really Ivan Maidansky)
authorhboehm <hboehm>
Sun, 1 Mar 2009 00:43:01 +0000 (00:43 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:44 +0000 (21:06 +0400)
* alloc.c (GC_try_to_collect): Remove duplicate initialization
check.
* malloc.c (GC_generic_malloc): Remove lw to eliminate single-
threaded warnings.
* mallocx.c (GC_generic_malloc_ignore_off_page): Ditto.

ChangeLog
alloc.c
malloc.c
mallocx.c

index 5fb8b053684ab3de3ebae42137e8fad47a81eea1..2f75153fc958644dab1df53690b88df6c83242e1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-02-28  Hans Boehm <Hans.Boehm@hp.com> (Really Ivan Maidansky)
+       * alloc.c (GC_try_to_collect): Remove duplicate initialization
+       check.
+       * malloc.c (GC_generic_malloc): Remove lw to eliminate single-
+       threaded warnings.
+       * mallocx.c (GC_generic_malloc_ignore_off_page): Ditto.
+
 2009-02-28  Hans Boehm <Hans.Boehm@hp.com> (Mostly Ivan Maidansky)
        * allchblk.c, backgraph.c, dbg_mlc.c, dyn_load.c,
        finalize.c, include/private/gc_pmark.h, malloc.c, mark.c,
diff --git a/alloc.c b/alloc.c
index f40282a63d9c494560fcdfd40eef4164bd7ef957..015962196c45db32c816a4daabd38f83e5069b87 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -822,7 +822,6 @@ GC_API int GC_CALL GC_try_to_collect(GC_stop_func stop_func)
     GC_INVOKE_FINALIZERS();
     LOCK();
     ENTER_GC();
-    if (!GC_is_initialized) GC_init_inner();
     /* Minimize junk left in my registers */
       GC_noop(0,0,0,0,0,0);
     result = (int)GC_try_to_collect_inner(stop_func);
index 7d214af34c671ede112bf11c54c33bf7d3717db8..62fc64cfa38f66d5a385c0a4cdd1c1af0551716d 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -159,12 +159,11 @@ void * GC_generic_malloc(size_t lb, int k)
         result = GC_generic_malloc_inner((word)lb, k);
        UNLOCK();
     } else {
-       size_t lg, lw;
+       size_t lg;
        size_t lb_rounded;
        word n_blocks;
        GC_bool init;
        lg = ROUNDED_UP_GRANULES(lb);
-       lw = GRANULES_TO_WORDS(lg);
        lb_rounded = GRANULES_TO_BYTES(lg);
        n_blocks = OBJ_SZ_TO_BLOCKS(lb_rounded);
        init = GC_obj_kinds[k].ok_init;
@@ -179,8 +178,8 @@ void * GC_generic_malloc(size_t lb, int k)
              /* before we release the lock.                          */
                ((word *)result)[0] = 0;
                ((word *)result)[1] = 0;
-               ((word *)result)[lw-1] = 0;
-               ((word *)result)[lw-2] = 0;
+               ((word *)result)[GRANULES_TO_WORDS(lg)-1] = 0;
+               ((word *)result)[GRANULES_TO_WORDS(lg)-2] = 0;
 #          endif
          }
        }
index b010bccbdcf3188e851e4e43a8bf9639848ec2e9..60637a10dd527dd217f074c40aae02868627ee94 100644 (file)
--- a/mallocx.c
+++ b/mallocx.c
@@ -167,7 +167,7 @@ void * realloc(void * p, size_t lb)
 void * GC_generic_malloc_ignore_off_page(size_t lb, int k)
 {
     void *result;
-    size_t lg, lw;
+    size_t lg;
     size_t lb_rounded;
     word n_blocks;
     GC_bool init;
@@ -176,7 +176,6 @@ void * GC_generic_malloc_ignore_off_page(size_t lb, int k)
     if (SMALL_OBJ(lb))
         return(GC_generic_malloc((word)lb, k));
     lg = ROUNDED_UP_GRANULES(lb);
-    lw = GRANULES_TO_WORDS(lg);
     lb_rounded = GRANULES_TO_BYTES(lg);
     n_blocks = OBJ_SZ_TO_BLOCKS(lb_rounded);
     init = GC_obj_kinds[k].ok_init;
@@ -193,8 +192,8 @@ void * GC_generic_malloc_ignore_off_page(size_t lb, int k)
              /* before we release the lock.                          */
                ((word *)result)[0] = 0;
                ((word *)result)[1] = 0;
-               ((word *)result)[lw-1] = 0;
-               ((word *)result)[lw-2] = 0;
+               ((word *)result)[GRANULES_TO_WORDS(lg)-1] = 0;
+               ((word *)result)[GRANULES_TO_WORDS(lg)-2] = 0;
 #          endif
         }
     }