]> granicus.if.org Git - gc/commitdiff
2008-10-27 Hans Boehm <Hans.Boehm@hp.com> (Really Ivan Maidansky)
authorhboehm <hboehm>
Tue, 28 Oct 2008 00:58:57 +0000 (00:58 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:43 +0000 (21:06 +0400)
* thread_local_alloc.c, include/private/thread_local_alloc.h:
Fix typos in comments.
* finalize.c: Declare mark_procs and GC_register_finalizer_inner
STATIC.
* malloc.c (GC_free): Move size calculation below assertion.

ChangeLog
finalize.c
include/private/thread_local_alloc.h
malloc.c
thread_local_alloc.c

index fae49da7b4343fd6f322afc715adc2c4ac10541f..ce57d7c7dae8d9f2c7eec26b5fdb27767bd19678 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-27  Hans Boehm <Hans.Boehm@hp.com> (Really Ivan Maidansky)
+       * thread_local_alloc.c, include/private/thread_local_alloc.h:
+       Fix typos in comments.
+       * finalize.c: Declare mark_procs and GC_register_finalizer_inner
+       STATIC.
+       * malloc.c (GC_free): Move size calculation below assertion.
+
 2008-10-27  Hans Boehm <Hans.Boehm@hp.com>
        * win32_threads.c (GC_get_stack_min, GC_may_be_in_stack):
        Add one entry VirtualQuery cache, I_HOLD_LOCK assertions.
index 7a4ada276e23721f28316f702db05eac5d24d421..db0f2a9be92c5e4817c5141049734f5e93cb40f7 100644 (file)
@@ -155,7 +155,7 @@ GC_API int GC_CALL GC_general_register_disappearing_link(void * * link,
     struct disappearing_link * new_dl;
     DCL_LOCK_STATE;
     
-    if ((word)link & (ALIGNMENT-1))
+    if (((word)link & (ALIGNMENT-1)) || link == NULL)
        ABORT("Bad arg to GC_general_register_disappearing_link");
 #   ifdef THREADS
        LOCK();
@@ -244,7 +244,7 @@ out:
 
 /* Possible finalization_marker procedures.  Note that mark stack      */
 /* overflow is handled by the caller, and is not a disaster.           */
-GC_API void GC_normal_finalize_mark_proc(ptr_t p)
+STATIC void GC_normal_finalize_mark_proc(ptr_t p)
 {
     hdr * hhdr = HDR(p);
     
@@ -255,7 +255,7 @@ GC_API void GC_normal_finalize_mark_proc(ptr_t p)
 /* This only pays very partial attention to the mark descriptor.       */
 /* It does the right thing for normal and atomic objects, and treats   */
 /* most others as normal.                                              */
-GC_API void GC_ignore_self_finalize_mark_proc(ptr_t p)
+STATIC void GC_ignore_self_finalize_mark_proc(ptr_t p)
 {
     hdr * hhdr = HDR(p);
     word descr = hhdr -> hb_descr;
@@ -277,7 +277,7 @@ GC_API void GC_ignore_self_finalize_mark_proc(ptr_t p)
 }
 
 /*ARGSUSED*/
-GC_API void GC_null_finalize_mark_proc(ptr_t p)
+STATIC void GC_null_finalize_mark_proc(ptr_t p)
 {
 }
 
@@ -289,7 +289,7 @@ GC_API void GC_null_finalize_mark_proc(ptr_t p)
 /* behavior.  Objects registered in this way are not finalized         */
 /* if they are reachable by other finalizable objects, eve if those    */
 /* other objects specify no ordering.                                  */
-GC_API void GC_unreachable_finalize_mark_proc(ptr_t p)
+STATIC void GC_unreachable_finalize_mark_proc(ptr_t p)
 {
     GC_normal_finalize_mark_proc(p);
 }
@@ -304,7 +304,7 @@ GC_API void GC_unreachable_finalize_mark_proc(ptr_t p)
 /* marking for finalization ordering.  Any objects marked      */
 /* by that procedure will be guaranteed to not have been       */
 /* finalized when this finalizer is invoked.                   */
-GC_API void GC_register_finalizer_inner(void * obj,
+STATIC void GC_register_finalizer_inner(void * obj,
                                        GC_finalization_proc fn, void *cd,
                                        GC_finalization_proc *ofn, void **ocd,
                                        finalization_mark_proc mp)
index 90a246a0eaed384cf3e768f58a6fa5be91152bcc..016bc867ebb81317ee157a0313ac561016378de0 100644 (file)
@@ -133,7 +133,7 @@ void GC_destroy_thread_local(GC_tlfs p);
 
 /* The thread support layer must arrange to mark thread-local  */
 /* free lists explicitly, since the link field is often        */
-/* invisible to the marker.  It knows hoe to find all threads; */
+/* invisible to the marker.  It knows how to find all threads; */
 /* we take care of an individual thread freelist structure.    */
 void GC_mark_thread_local_fls_for(GC_tlfs p);
 
index 88d5619d152ff75b4669600d9746ac4392e8efc8..3329760834141ef4c09c732a64bc61842467b3f6 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -405,8 +405,6 @@ GC_API void GC_CALL GC_free(void * p)
 #   endif
     h = HBLKPTR(p);
     hhdr = HDR(h);
-    sz = hhdr -> hb_sz;
-    ngranules = BYTES_TO_GRANULES(sz);
 #   if defined(REDIRECT_MALLOC) && \
        (defined(GC_SOLARIS_THREADS) || defined(GC_LINUX_THREADS) \
         || defined(MSWIN32))
@@ -417,6 +415,8 @@ GC_API void GC_CALL GC_free(void * p)
        if (0 == hhdr) return;
 #   endif
     GC_ASSERT(GC_base(p) == p);
+    sz = hhdr -> hb_sz;
+    ngranules = BYTES_TO_GRANULES(sz);
     knd = hhdr -> hb_obj_kind;
     ok = &GC_obj_kinds[knd];
     if (EXPECT((ngranules <= MAXOBJGRANULES), 1)) {
index 6e8efdad279e785e80e0e2219d6c7269d2bdddd3..a423ce3343d0be090ba9b1c6b55287569b298079 100644 (file)
@@ -284,7 +284,7 @@ GC_API void * GC_CALL GC_gcj_malloc(size_t bytes,
 
 /* The thread support layer must arrange to mark thread-local  */
 /* free lists explicitly, since the link field is often        */
-/* invisible to the marker.  It knows hoe to find all threads; */
+/* invisible to the marker.  It knows how to find all threads; */
 /* we take care of an individual thread freelist structure.    */
 void GC_mark_thread_local_fls_for(GC_tlfs p)
 {