+
+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.
"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 */
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
* 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) */
* 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 */
#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.
*/
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);
# 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,
# define INLINE
#endif /* __GNUC__ */
+#ifndef GC_API_PRIV
+# define GC_API_PRIV GC_API
+#endif
+
# ifndef GC_LOCKS_H
# include "gc_locks.h"
# endif
# 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
#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
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. */
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);
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 ... */
/* 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 */