pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:16:   #include "pike_types.h"   #include "fsort.h"   #include "builtin_functions.h"   #include "pike_memory.h"   #include "gc.h"   #include "main.h"   #include "security.h"   #include "stuff.h"   #include "bignum.h"    - RCSID("$Id: array.c,v 1.119 2001/09/25 05:55:09 hubbe Exp $"); + RCSID("$Id: array.c,v 1.120 2001/10/15 09:20:58 mast Exp $");      PMOD_EXPORT struct array empty_array=   {    PIKE_CONSTANT_MEMOBJ_INIT(1), /* Never free */    &weak_empty_array, /* Next */    &weak_shrink_empty_array, /* previous (circular) */    0, /* Size = 0 */    0, /* malloced Size = 0 */    0, /* no types */    0, /* no flags */
pike.git/src/array.c:2130:   void real_gc_cycle_check_array(struct array *a, int weak)   {    GC_CYCLE_ENTER(a, weak) {   #ifdef PIKE_DEBUG    if (a == &empty_array || a == &weak_empty_array || a == &weak_shrink_empty_array)    fatal("Trying to gc cycle check some *_empty_array.\n");   #endif       if (a->type_field & BIT_COMPLEX)    { -  if (a->flags & ARRAY_WEAK_FLAG) { -  if (gc_cycle_check_weak_svalues(ITEM(a), a->size)) { - #ifdef PIKE_DEBUG -  fatal("Didn't expect an svalue zapping now.\n"); - #endif -  } -  gc_assert_checked_as_weak(a); -  } -  else { -  TYPE_FIELD t; -  if ((t = gc_cycle_check_svalues(ITEM(a), a->size))) { +  TYPE_FIELD t = a->flags & ARRAY_WEAK_FLAG ? +  gc_cycle_check_weak_svalues(ITEM(a), a->size) : +  gc_cycle_check_svalues(ITEM(a), a->size); +  if (t) { +  /* In the weak case we should only get here if references to +  * destructed objects are removed. */    if(!(a->type_field & BIT_UNFINISHED) || a->refs!=1)    a->type_field = t;    else    a->type_field |= t;    } -  + #ifdef PIKE_DEBUG +  if (a->flags & ARRAY_WEAK_FLAG) +  gc_assert_checked_as_weak(a); +  else    gc_assert_checked_as_nonweak(a); -  + #endif    } -  } +     } GC_CYCLE_LEAVE;   }      #ifdef PIKE_DEBUG   unsigned gc_touch_all_arrays(void)   {    unsigned n = 0;    struct array *a = &empty_array;    do {    debug_gc_touch(a);