2009-09-10 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Thu, 10 Sep 2009 17:22:18 +0000 (17:22 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:46 +0000 (21:06 +0400)
(diff103_cvs)

* alloc.c (GC_stopped_mark): Remove GC_log_printf("") (not needed
anymore and GCC produces a warning for it).
* alloc.c (GC_stopped_mark): Adjust printf argument type
specifier.
* backgraph.c: Include dbg_mlc.h before ifdef MAKE_BACK_GRAPH (for
the case when the configuration information comes from aconfig
file).
* checksums.c: Ditto (for gc_priv.h and CHECKSUMS, respectively).
* include/gc_allocator.h (GC_ATTR_UNUSED): Use "__unused__"
keyword instead of "unused".
* include/gc_allocator.h: Fix typos in comments.
* thread_local_alloc.c: Ditto.
* include/javaxfc.h (GC_finalize_all): Update comment.
* include/private/gc_priv.h (GC_API_PRIV): New macro (defined as
GC_API and serves only as a marker for the private but exported
symbols used by test.c only).
* include/private/gc_priv.h (GC_abort, GC_arrays, GC_is_marked,
GC_printf, GC_err_printf, GC_log_printf): Replace GC_API decl with
GC_API_PRIV one.
* include/private/gc_priv.h (GC_fo_entries): Don't export it
outside a DLL.
* include/private/gc_priv.h (GC_ATTR_FORMAT_PRINTF): New macro
designated to check the arguments correctness of printf-like
functions (currently works only for GCC v3+).
* include/private/gc_priv.h (GC_printf, GC_err_printf,
GC_log_printf): Use GC_ATTR_FORMAT_PRINTF attribute.

ChangeLog
alloc.c
backgraph.c
checksums.c
include/gc_allocator.h
include/javaxfc.h
include/private/gc_priv.h
thread_local_alloc.c

index 091408d..8c19ea1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+
+2009-09-10  Ivan Maidanski <ivmai@mail.ru>
+       (diff103_cvs)
+
+       * alloc.c (GC_stopped_mark): Remove GC_log_printf("") (not needed
+       anymore and GCC produces a warning for it).
+       * alloc.c (GC_stopped_mark): Adjust printf argument type
+       specifier.
+       * backgraph.c: Include dbg_mlc.h before ifdef MAKE_BACK_GRAPH (for
+       the case when the configuration information comes from aconfig
+       file).
+       * checksums.c: Ditto (for gc_priv.h and CHECKSUMS, respectively).
+       * include/gc_allocator.h (GC_ATTR_UNUSED): Use "__unused__"
+       keyword instead of "unused".
+       * include/gc_allocator.h: Fix typos in comments.
+       * thread_local_alloc.c: Ditto.
+       * include/javaxfc.h (GC_finalize_all): Update comment.
+       * include/private/gc_priv.h (GC_API_PRIV): New macro (defined as
+       GC_API and serves only as a marker for the private but exported
+       symbols used by test.c only).
+       * include/private/gc_priv.h (GC_abort, GC_arrays, GC_is_marked,
+       GC_printf, GC_err_printf, GC_log_printf): Replace GC_API decl with
+       GC_API_PRIV one.
+       * include/private/gc_priv.h (GC_fo_entries): Don't export it
+       outside a DLL.
+       * include/private/gc_priv.h (GC_ATTR_FORMAT_PRINTF): New macro
+       designated to check the arguments correctness of printf-like
+       functions (currently works only for GCC v3+).
+       * include/private/gc_priv.h (GC_printf, GC_err_printf,
+       GC_log_printf): Use GC_ATTR_FORMAT_PRINTF attribute.
+
 2009-09-03  Hans Boehm <Hans.Boehm@hp.com> (really Loren J. Rittle)
 
        * dyn_load.c (HAVE_DL_ITERATE_PHDR): Break definition from use.
diff --git a/alloc.c b/alloc.c
index 3a61fb5..ee2c0e3 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -571,9 +571,6 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
             "Collection %lu reclaimed %ld bytes ---> heapsize = %lu bytes\n",
             (unsigned long)(GC_gc_no - 1), (long)GC_bytes_found,
             (unsigned long)GC_heapsize);
-        /* Printf arguments may be pushed in funny places.  Clear the  */
-        /* space.                                                      */
-      GC_log_printf("");
     }
 
     /* Check all debugged objects for consistency */
@@ -606,7 +603,7 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func)
        
        GC_ASSERT(divisor != 0);
        GC_log_printf(
-               "World-stopped marking took %lu msecs (%lu in average)\n",
+               "World-stopped marking took %lu msecs (%u in average)\n",
                time_diff, total_time / divisor);
       }
 #   endif
index 0ca0519..be33d74 100644 (file)
  * a growing space leak.
  */
 
+#include "private/dbg_mlc.h"
+
 #ifdef MAKE_BACK_GRAPH
 
 #define MAX_IN 10      /* Maximum in-degree we handle directly */
 
-#include "private/dbg_mlc.h"
 /* #include <unistd.h> */
 
 #if !defined(DBG_HDRS_ALL) || (ALIGNMENT != CPP_WORDSZ/8) /* || !defined(UNIX_LIKE) */
index 275026d..6e1df9c 100644 (file)
  * modified is included with the above copyright notice.
  */
 /* Boehm, March 29, 1995 12:51 pm PST */
-# ifdef CHECKSUMS
 
 # include "private/gc_priv.h"
 
+# ifdef CHECKSUMS
+
 /* This is debugging code intended to verify the results of dirty bit  */
 /* computations. Works only in a single threaded environment.          */
 /* We assume that stubborn objects are changed only when they are      */
index c33c249..686c985 100644 (file)
 #include <new> // for placement new
 
 #if defined(__GNUC__)
-#  define GC_ATTR_UNUSED __attribute__((unused))
+#  define GC_ATTR_UNUSED __attribute__((__unused__))
 #else
 #  define GC_ATTR_UNUSED
 #endif
 
 /* First some helpers to allow us to dispatch on whether or not a type
- * is known to be pointerfree.
+ * is known to be pointer-free.
  * These are private, except that the client may invoke the
  * GC_DECLARE_PTRFREE macro.
  */
@@ -81,8 +81,8 @@ GC_DECLARE_PTRFREE(double);
 GC_DECLARE_PTRFREE(long double);
 /* The client may want to add others.  */
 
-// In the following GC_Tp is GC_true_type iff we are allocating a
-// pointerfree object.
+// In the following GC_Tp is GC_true_type if we are allocating a
+// pointer-free object.
 template <class GC_Tp>
 inline void * GC_selective_alloc(size_t n, GC_Tp, bool ignore_off_page) {
     return ignore_off_page?GC_MALLOC_IGNORE_OFF_PAGE(n):GC_MALLOC(n);
index 43f3bac..3878727 100644 (file)
@@ -7,9 +7,9 @@
 # endif
 
 /*
- * Invoke all remaining finalizers that haven't yet been run, or
- * repeatedly notify that there are finalizers to be run.
- * This is needed for strict compliance with the Java standard, 
+ * Invoke all remaining finalizers that haven't yet been run.  (Since the
+ * notifier is not called, this should be called from a separate thread.)
+ * This function is needed for strict compliance with the Java standard,
  * which can make the runtime guarantee that all finalizers are run.
  * This is problematic for several reasons:
  * 1) It means that finalizers, and all methods called by them,
index 520c791..e2788a9 100644 (file)
@@ -85,6 +85,10 @@ typedef char * ptr_t;        /* A generic pointer to which we can add        */
 # define INLINE
 #endif /* __GNUC__ */
 
+#ifndef GC_API_PRIV
+# define GC_API_PRIV GC_API
+#endif
+
 # ifndef GC_LOCKS_H
 #   include "gc_locks.h"
 # endif
@@ -337,7 +341,7 @@ void GC_print_callers(struct callinfo info[NFRAMES]);
 #          define ABORT(msg) abort()
 #      endif
 #   else
-       GC_API void GC_abort(const char * msg);
+       GC_API_PRIV void GC_abort(const char * msg);
 #       define ABORT(msg) GC_abort(msg)
 #   endif
 # endif
@@ -1047,7 +1051,7 @@ struct _GC_arrays {
 #endif
 };
 
-GC_API GC_FAR struct _GC_arrays GC_arrays; 
+GC_API_PRIV GC_FAR struct _GC_arrays GC_arrays; 
 
 # ifndef SEPARATE_GLOBALS
 #   define GC_objfreelist GC_arrays._objfreelist
@@ -1185,7 +1189,7 @@ extern struct obj_kind {
 
 extern unsigned GC_n_kinds;
 
-GC_API word GC_fo_entries;
+extern word GC_fo_entries;
 
 extern word GC_n_heap_sects;   /* Number of separately added heap      */
                                /* sections.                            */
@@ -1857,7 +1861,7 @@ void GC_remove_protection(struct hblk *h, word nblocks,
 void GC_dirty_init(void);
   
 /* Slow/general mark bit manipulation: */
-GC_API GC_bool GC_is_marked(ptr_t p);
+GC_API_PRIV GC_bool GC_is_marked(ptr_t p);
 void GC_clear_mark_bit(ptr_t p);
 void GC_set_mark_bit(ptr_t p);
   
@@ -1900,14 +1904,26 @@ void GC_print_finalization_stats(void);
 
 GC_API void GC_CALL GC_noop1(word);
 
+#ifndef GC_ATTR_FORMAT_PRINTF
+# if defined(__GNUC__) && __GNUC__ >= 3
+#   define GC_ATTR_FORMAT_PRINTF(spec_argnum, first_checked) \
+       __attribute__((__format__(__printf__, spec_argnum, first_checked)))
+# else
+#   define GC_ATTR_FORMAT_PRINTF(spec_argnum, first_checked)
+# endif
+#endif
+
 /* Logging and diagnostic output:      */
-GC_API void GC_printf (const char * format, ...);
+GC_API_PRIV void GC_printf(const char * format, ...)
+                       GC_ATTR_FORMAT_PRINTF(1, 2);
                        /* A version of printf that doesn't allocate,   */
                        /* 1K total output length.                      */
                        /* (We use sprintf.  Hopefully that doesn't     */
                        /* allocate for long arguments.)                */
-GC_API void GC_err_printf(const char * format, ...);
-GC_API void GC_log_printf(const char * format, ...);
+GC_API_PRIV void GC_err_printf(const char * format, ...)
+                       GC_ATTR_FORMAT_PRINTF(1, 2);
+GC_API_PRIV void GC_log_printf(const char * format, ...)
+                       GC_ATTR_FORMAT_PRINTF(1, 2);
 void GC_err_puts(const char *s);
                        /* Write s to stderr, don't buffer, don't add   */
                        /* newlines, don't ...                          */
index 4d907fe..0e78f2f 100644 (file)
@@ -234,7 +234,7 @@ extern int GC_gcj_kind;
 /* the marker may run asynchronously, and may pick up the pointer to   */
 /* the next freelist entry (which it thinks is a vtable pointer), get  */
 /* suspended for a while, and then see an allocated object instead     */
-/* of the vtable.  This made be avoidable with either a handshake with */
+/* of the vtable.  This may be avoidable with either a handshake with  */
 /* the collector or, probably more easily, by moving the free list     */
 /* links to the second word of each object.  The latter isn't a                */
 /* universal win, since on architecture like Itanium, nonzero offsets  */