/[dotgnu-pnet]/pnet/libgc/finalize.c
ViewVC logotype

Diff of /pnet/libgc/finalize.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by tum, Wed May 26 22:32:17 2004 UTC revision 1.5 by ktreichel, Sat Jul 23 12:52:58 2005 UTC
# Line 807  void (* GC_finalizer_notifier)() = (void Line 807  void (* GC_finalizer_notifier)() = (void
807    
808  static GC_word last_finalizer_notification = 0;  static GC_word last_finalizer_notification = 0;
809    
 #ifdef KEEP_BACK_PTRS  
 void GC_generate_random_backtrace_no_gc(void);  
 #endif  
   
810  void GC_notify_or_invoke_finalizers GC_PROTO((void))  void GC_notify_or_invoke_finalizers GC_PROTO((void))
811  {  {
812      /* This is a convenient place to generate backtraces if appropriate, */      /* This is a convenient place to generate backtraces if appropriate, */
813      /* since that code is not callable with the allocation lock.         */      /* since that code is not callable with the allocation lock.         */
814  #   ifdef KEEP_BACK_PTRS  #   if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH)
815        if (GC_backtraces > 0) {        static word last_back_trace_gc_no = 1;    /* Skip first one. */
816          static word last_back_trace_gc_no = 3;  /* Skip early ones. */  
817          long i;        if (GC_gc_no > last_back_trace_gc_no) {
818            word i;
819    
820          LOCK();  #       ifdef KEEP_BACK_PTRS
821          if (GC_gc_no > last_back_trace_gc_no) {            LOCK();
822            /* Stops when GC_gc_no wraps; that's OK.      */            /* Stops when GC_gc_no wraps; that's OK.      */
823              last_back_trace_gc_no = (word)(-1);  /* disable others. */            last_back_trace_gc_no = (word)(-1);  /* disable others. */
824              for (i = 0; i < GC_backtraces; ++i) {            for (i = 0; i < GC_backtraces; ++i) {
825                /* FIXME: This tolerates concurrent heap mutation,        */                /* FIXME: This tolerates concurrent heap mutation,        */
826                /* which may cause occasional mysterious results.         */                /* which may cause occasional mysterious results.         */
827                /* We need to release the GC lock, since GC_print_callers */                /* We need to release the GC lock, since GC_print_callers */
# Line 832  void GC_notify_or_invoke_finalizers GC_P Line 829  void GC_notify_or_invoke_finalizers GC_P
829                UNLOCK();                UNLOCK();
830                GC_generate_random_backtrace_no_gc();                GC_generate_random_backtrace_no_gc();
831                LOCK();                LOCK();
832              }            }
833              last_back_trace_gc_no = GC_gc_no;            last_back_trace_gc_no = GC_gc_no;
834          }            UNLOCK();
835          UNLOCK();  #       endif
836    #       ifdef MAKE_BACK_GRAPH
837              if (GC_print_back_height)
838                GC_print_back_graph_stats();
839    #       endif
840        }        }
841  #   endif  #   endif
842      if (GC_finalize_now == 0) return;      if (GC_finalize_now == 0) return;

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26