Branch: Tag:

2003-09-08

2003-09-08 20:05:21 by Martin Stjernholm <mast@lysator.liu.se>

Cleaned up the gc check stuff a bit (large indentantion changes). Added more
tracking in the gc to help track down bugs when the gc follows munged
pointers in the mark pass. That's activated with GC_MARK_DEBUG.

Rev: src/array.c:1.149
Rev: src/backend.cmod:1.47
Rev: src/error.c:1.115
Rev: src/gc.c:1.228
Rev: src/gc.h:1.104
Rev: src/interpret.c:1.329
Rev: src/mapping.c:1.170
Rev: src/multiset.c:1.78
Rev: src/object.c:1.247
Rev: src/program.c:1.524
Rev: src/security.c:1.45
Rev: src/svalue.c:1.173
Rev: src/svalue.h:1.123
Rev: src/threads.c:1.220

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: array.c,v 1.148 2003/08/26 18:33:20 mast Exp $ + || $Id: array.c,v 1.149 2003/09/08 20:05:20 mast Exp $   */      #include "global.h"
26:   #include "cyclic.h"   #include "multiset.h"    - RCSID("$Id: array.c,v 1.148 2003/08/26 18:33:20 mast Exp $"); + RCSID("$Id: array.c,v 1.149 2003/09/08 20:05:20 mast Exp $");      PMOD_EXPORT struct array empty_array=   {
2262:      static void gc_check_array(struct array *a)   { +  GC_ENTER (a, T_ARRAY) {    if(a->type_field & BIT_COMPLEX)    {    if (a->flags & ARRAY_WEAK_FLAG) { -  debug_gc_check_weak_svalues(ITEM(a), a->size, T_ARRAY, a); +  gc_check_weak_svalues(ITEM(a), a->size);    gc_checked_as_weak(a);    }    else -  debug_gc_check_svalues(ITEM(a), a->size, T_ARRAY, a); +  gc_check_svalues(ITEM(a), a->size);    } -  +  } GC_LEAVE;   }      void gc_mark_array_as_referenced(struct array *a)   { -  if(gc_mark(a)) { +  if(gc_mark(a)) +  GC_ENTER (a, T_ARRAY) {   #ifdef PIKE_DEBUG    if (a == &empty_array || a == &weak_empty_array || a == &weak_shrink_empty_array)    Pike_fatal("Trying to gc mark some *_empty_array.\n");
2337:    gc_assert_checked_as_nonweak(a);    }    } +  } GC_LEAVE;   } - } +       void real_gc_cycle_check_array(struct array *a, int weak)   { -  GC_CYCLE_ENTER(a, weak) { +  GC_CYCLE_ENTER(a, T_ARRAY, weak) {   #ifdef PIKE_DEBUG    if (a == &empty_array || a == &weak_empty_array || a == &weak_shrink_empty_array)    Pike_fatal("Trying to gc cycle check some *_empty_array.\n");
2434:    gc_mark_array_pos = a->next;    gc_mark_array_as_referenced(a);    } -  discard_queue(&gc_mark_queue); +  gc_mark_discard_queue();   }      size_t gc_free_all_unreferenced_arrays(void)