Branch: Tag:

2000-07-18

2000-07-18 06:53:58 by Martin Stjernholm <mast@lysator.liu.se>

Fixed bug when running without debug.

Rev: src/gc.c:1.109
Rev: src/gc.h:1.56

29:      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.108 2000/07/18 06:30:57 mast Exp $"); + RCSID("$Id: gc.c,v 1.109 2000/07/18 06:53:58 mast Exp $");      /* Run garbage collect approximately every time    * 20 percent of all arrays, objects and programs is
1108: Inside #if defined(PIKE_DEBUG)
   return 0;   }    + void debug_really_free_gc_frame(struct gc_frame *l) + { +  if (l->frameflags & GC_LINK_FREED) +  gc_fatal(l->data, 0, "Freeing freed gc_frame.\n"); +  l->frameflags |= GC_LINK_FREED; +  l->back = PREV(l) = NEXT(l) = (struct gc_frame *) -1; +  really_free_gc_frame(l); + #ifdef GC_VERBOSE +  num_gc_frames--; + #endif + } +  + #else /* PIKE_DEBUG */ +  + #define debug_really_free_gc_frame(l) really_free_gc_frame(l) +  + #endif /* PIKE_DEBUG */ +    int gc_do_weak_free(void *a)   {    struct marker *m;    -  + #ifdef PIKE_DEBUG    if (!a) fatal("Got null pointer.\n");    if (Pike_in_gc != GC_PASS_MARK && Pike_in_gc != GC_PASS_CYCLE &&    Pike_in_gc != GC_PASS_ZAP_WEAK)
1125: Inside #if defined(PIKE_DEBUG)
      if (m->weak_refs > m->refs)    gc_fatal(a, 0, "More weak references than internal references.\n"); + #else +  m = get_marker(a); + #endif       if (Pike_in_gc != GC_PASS_ZAP_WEAK) {    if (m->weak_refs == -1) {
1134: Inside #if defined(PIKE_DEBUG)
   }    else    if (!(m->flags & GC_MARKED)) { + #ifdef PIKE_DEBUG    if (m->weak_refs <= 0)    gc_fatal(a, 0, "Too many weak refs cleared to thing with external "    "weak refs.\n"); -  + #endif    m->weak_refs--;    gc_ext_weak_refs--;    return 1;
1144: Inside #if defined(PIKE_DEBUG)
   return 0;   }    - void debug_really_free_gc_frame(struct gc_frame *l) - { -  if (l->frameflags & GC_LINK_FREED) -  gc_fatal(l->data, 0, "Freeing freed gc_frame.\n"); -  l->frameflags |= GC_LINK_FREED; -  l->back = PREV(l) = NEXT(l) = (struct gc_frame *) -1; -  really_free_gc_frame(l); - #ifdef GC_VERBOSE -  num_gc_frames--; - #endif - } -  - #else /* PIKE_DEBUG */ -  - #define debug_really_free_gc_frame(l) really_free_gc_frame(l) -  - #endif /* PIKE_DEBUG */ -  +    int gc_mark(void *a)   {    struct marker *m = get_marker(debug_malloc_pass(a));
2067: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    destroy_count++;   #endif -  really_free_gc_frame(kill_list); +  debug_really_free_gc_frame(kill_list);    kill_list = next;    }