pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:1:   /*   || 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"   #include "svalue.h"   #include "array.h"   #include "object.h"   #include "las.h"   #include "stralloc.h"   #include "interpret.h"   #include "opcodes.h"
pike.git/src/array.c:19:   #include "builtin_functions.h"   #include "pike_memory.h"   #include "gc.h"   #include "main.h"   #include "security.h"   #include "stuff.h"   #include "bignum.h"   #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=   {    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:2255: Inside #if defined(PIKE_DEBUG)
   a=a->next;    if(!a)    Pike_fatal("Null pointer in array list.\n");    } while (a != & empty_array);   }   #endif /* PIKE_DEBUG */         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");   #endif       if (a == gc_mark_array_pos)    gc_mark_array_pos = a->next;    if (a == gc_internal_array)    gc_internal_array = a->next;    else {
pike.git/src/array.c:2330:    TYPE_FIELD t;    if ((t = gc_mark_svalues(ITEM(a), a->size))) {    if(!(a->type_field & BIT_UNFINISHED) || a->refs!=1)    a->type_field = t;    else    a->type_field |= t;    }    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");   #endif       if (a->type_field & BIT_COMPLEX)    {    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);
pike.git/src/array.c:2427:   }      void gc_zap_ext_weak_refs_in_arrays(void)   {    gc_mark_array_pos = empty_array.next;    while (gc_mark_array_pos != gc_internal_array && gc_ext_weak_refs) {    struct array *a = gc_mark_array_pos;    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)   {    struct array *a,*next;    size_t unreferenced = 0;       for (a = gc_internal_array; a != &weak_empty_array; a = next)    {   #ifdef PIKE_DEBUG