2007-10-24 Hans Boehm <Hans.Boehm@hp.com>
authorhboehm <hboehm>
Thu, 25 Oct 2007 00:41:06 +0000 (00:41 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:41 +0000 (21:06 +0400)
* reclaim.c (GC_bytes_found): Expand comment.
* thread_local_alloc.c (GC_malloc_atomic, GC_gcj_malloc): Pass
granules, not bytes, to GC_FAST_MALLOC_GRANS.
* include/gc.h: Never include gc_local_alloc.h.
* tests/test.c: Add size zero allocation tests.

ChangeLog
include/gc.h
reclaim.c
tests/test.c
thread_local_alloc.c

index b3fa4f5..bb4243d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-10-24  Hans Boehm <Hans.Boehm@hp.com>
+
+       * reclaim.c (GC_bytes_found): Expand comment.
+       * thread_local_alloc.c (GC_malloc_atomic, GC_gcj_malloc): Pass
+       granules, not bytes, to GC_FAST_MALLOC_GRANS.
+       * include/gc.h: Never include gc_local_alloc.h.
+       * tests/test.c: Add size zero allocation tests.
+
 2007-10-23  Hans Boehm <Hans.Boehm@hp.com>
 
        * malloc.c: Update GC_large_allocd_bytes on explicit deallocation.
index 4c09b6f..0c6f5e4 100644 (file)
@@ -1127,8 +1127,8 @@ GC_API void GC_use_DllMain(void);
 # include "gc_amiga_redirects.h"
 #endif
 
-#if defined(GC_REDIRECT_TO_LOCAL) && !defined(GC_LOCAL_ALLOC_H)
-#  include  "gc_local_alloc.h"
+#if defined(GC_REDIRECT_TO_LOCAL)
+  /* Now redundant; that's the default with THREAD_LOCAL_ALLOC */
 #endif
 
 #ifdef __cplusplus
index cd50fa4..43fdf70 100644 (file)
--- a/reclaim.c
+++ b/reclaim.c
@@ -19,6 +19,8 @@
 
 signed_word GC_bytes_found = 0;
                        /* Number of bytes of memory reclaimed     */
+                       /* minus the number of bytes originally    */
+                       /* on free lists which we had to drop.     */
 
 #if defined(PARALLEL_MARK) || defined(THREAD_LOCAL_ALLOC)
   word GC_fl_builder_count = 0;
index afe80f2..190cd3a 100644 (file)
@@ -1127,9 +1127,19 @@ void run_one_test()
 #     endif
 #   endif /* DBG_HDRS_ALL */
     /* Test floating point alignment */
-   collectable_count += 2;
+        collectable_count += 2;
        *(double *)GC_MALLOC(sizeof(double)) = 1.0;
        *(double *)GC_MALLOC(sizeof(double)) = 1.0;
+    /* Test size 0 allocation a bit more */
+       {
+          size_t i;
+          for (i = 0; i < 10000; ++i) {
+            GC_MALLOC(0);
+            GC_FREE(GC_MALLOC(0));
+            GC_MALLOC_ATOMIC(0);
+            GC_FREE(GC_MALLOC_ATOMIC(0));
+          }
+        }
 #   ifdef GC_GCJ_SUPPORT
       GC_REGISTER_DISPLACEMENT(sizeof(struct fake_vtable *));
       GC_init_gcj_malloc(0, (void *)fake_gcj_mark_proc);
index fa1499e..5988175 100644 (file)
@@ -206,7 +206,7 @@ void * GC_malloc_atomic(size_t bytes)
 #   endif
     GC_ASSERT(GC_is_initialized);
     tiny_fl = ((GC_tlfs)tsd) -> ptrfree_freelists;
-    GC_FAST_MALLOC_GRANS(result, bytes, tiny_fl, DIRECT_GRANULES,
+    GC_FAST_MALLOC_GRANS(result, granules, tiny_fl, DIRECT_GRANULES,
                         PTRFREE, GC_core_malloc_atomic(bytes), 0/* no init */);
     return result;
 }
@@ -252,7 +252,7 @@ void * GC_gcj_malloc(size_t bytes,
     void **tiny_fl = ((GC_tlfs)GC_getspecific(GC_thread_key))
                                        -> gcj_freelists;
     GC_ASSERT(GC_gcj_malloc_initialized);
-    GC_FAST_MALLOC_GRANS(result, bytes, tiny_fl, DIRECT_GRANULES,
+    GC_FAST_MALLOC_GRANS(result, granules, tiny_fl, DIRECT_GRANULES,
                         GC_gcj_kind,
                         GC_core_gcj_malloc(bytes,
                                            ptr_to_struct_containing_descr),