summaryrefslogtreecommitdiff
path: root/boehm-gc/finalize.c
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-13 23:05:36 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-13 23:05:36 +0000
commite08a5204e5f7a3c3a15588de39202f9579ba0e79 (patch)
tree863181355c9339e1361dad10263a322aaabe426e /boehm-gc/finalize.c
parent7cde58555127f31ba0a5b2a222c81d160e7168e9 (diff)
downloadgcc-e08a5204e5f7a3c3a15588de39202f9579ba0e79.tar.gz
libjava:
2004-08-13 Bryce McKinlay <mckinlay@redhat.com> * configure.in (GCINCS): Don't use "boehm-cflags". Instead, -I boehm-gc's include dirs. * configure: Rebuilt. * include/boehm-gc.h: Include gc_config.h. boehm-gc: 2004-08-13 Bryce McKinlay <mckinlay@redhat.com> * configure.ac (gc_cflags): Add -Iinclude. (AC_CONFIG_HEADERS): New. Configure gc_config.h header. Don't write DEFS to boehm-cflags file. * configure: Rebuilt. * gcj_mlc.c: Check #ifdef GC_GCJ_SUPPORT after including headers. * specific.c: Check #ifdef GC_LINUX_THREADS after including headers. * include/gc_config_macros.h: Remove backward-compatibility redefinitions of GC_ names. * include/gc.h: Include <gc_config.h>. 2004-08-13 Bryce McKinlay <mckinlay@redhat.com> Import Boehm GC version 6.3. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85972 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc/finalize.c')
-rw-r--r--boehm-gc/finalize.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/boehm-gc/finalize.c b/boehm-gc/finalize.c
index 3b9d9f5ea1e..e103228c2af 100644
--- a/boehm-gc/finalize.c
+++ b/boehm-gc/finalize.c
@@ -807,8 +807,37 @@ void (* GC_finalizer_notifier)() = (void (*) GC_PROTO((void)))0;
static GC_word last_finalizer_notification = 0;
+#ifdef KEEP_BACK_PTRS
+void GC_generate_random_backtrace_no_gc(void);
+#endif
+
void GC_notify_or_invoke_finalizers GC_PROTO((void))
{
+ /* This is a convenient place to generate backtraces if appropriate, */
+ /* since that code is not callable with the allocation lock. */
+# ifdef KEEP_BACK_PTRS
+ if (GC_backtraces > 0) {
+ static word last_back_trace_gc_no = 3; /* Skip early ones. */
+ long i;
+
+ LOCK();
+ if (GC_gc_no > last_back_trace_gc_no) {
+ /* Stops when GC_gc_no wraps; that's OK. */
+ last_back_trace_gc_no = (word)(-1); /* disable others. */
+ for (i = 0; i < GC_backtraces; ++i) {
+ /* FIXME: This tolerates concurrent heap mutation, */
+ /* which may cause occasional mysterious results. */
+ /* We need to release the GC lock, since GC_print_callers */
+ /* acquires it. It probably shouldn't. */
+ UNLOCK();
+ GC_generate_random_backtrace_no_gc();
+ LOCK();
+ }
+ last_back_trace_gc_no = GC_gc_no;
+ }
+ UNLOCK();
+ }
+# endif
if (GC_finalize_now == 0) return;
if (!GC_finalize_on_demand) {
(void) GC_invoke_finalizers();