Branch: Tag:

2008-05-11

2008-05-11 02:36:00 by Martin Stjernholm <mast@lysator.liu.se>

Implemented visit functions for the visit_thing_fn interface. The gc
check/mark functions are restored to how they were before the
GC_PASS_COUNT_MEMORY stuff.

Rev: src/array.c:1.206
Rev: src/array.h:1.74
Rev: src/constants.c:1.59
Rev: src/constants.h:1.36
Rev: src/mapping.c:1.200
Rev: src/mapping.h:1.67
Rev: src/multiset.c:1.110
Rev: src/multiset.h:1.43
Rev: src/object.c:1.290
Rev: src/object.h:1.95
Rev: src/pike_types.c:1.331
Rev: src/pike_types.h:1.114
Rev: src/program.c:1.691
Rev: src/program.h:1.242
Rev: src/stralloc.c:1.218
Rev: src/stralloc.h:1.103

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.205 2008/05/02 04:15:09 mast Exp $ + || $Id: array.c,v 1.206 2008/05/11 02:35:21 mast Exp $   */      #include "global.h"
2595:   #endif /* PIKE_DEBUG */       + void visit_array (struct array *a, int action) + { +  switch (action) { + #ifdef PIKE_DEBUG +  default: +  Pike_fatal ("Unknown visit action %d.\n", action); +  case VISIT_NORMAL: +  case VISIT_COMPLEX_ONLY: +  break; + #endif +  case VISIT_COUNT_BYTES: +  mc_counted_bytes += sizeof (struct array) + +  (a->malloced_size - 1) * sizeof (struct svalue); +  break; +  } +  +  if (a->type_field & +  (action & VISIT_COMPLEX_ONLY ? BIT_COMPLEX : BIT_REF_TYPES)) { +  size_t e, s = a->size; +  int ref_type = a->flags & ARRAY_WEAK_FLAG ? REF_TYPE_WEAK : REF_TYPE_NORMAL; +  for (e = 0; e < s; e++) +  visit_svalue (ITEM (a) + e, ref_type); +  } + } +    static void gc_check_array(struct array *a)   {    GC_ENTER (a, T_ARRAY) {
2614:   {    if(gc_mark(a))    GC_ENTER (a, T_ARRAY) { -  if (Pike_in_gc == GC_PASS_COUNT_MEMORY) { -  gc_counted_bytes += sizeof (struct array) + -  (a->malloced_size - 1) * sizeof (struct svalue); -  gc_check_array (a); -  } -  +     if (a == gc_mark_array_pos)    gc_mark_array_pos = a->next;    if (a == gc_internal_array)