pike.git / src / mapping.c

version» Context lines:

pike.git/src/mapping.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: mapping.c,v 1.89 2000/07/03 20:14:07 mast Exp $"); + RCSID("$Id: mapping.c,v 1.90 2000/07/04 00:43:57 mast Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "error.h"   #include "pike_memory.h"   #include "dynamic_buffer.h"   #include "interpret.h"
pike.git/src/mapping.c:1884:    }       if(gc_mark(m->data) &&    ((m->data->ind_types | m->data->val_types) & BIT_COMPLEX))    {    if (m->flags & MAPPING_FLAG_WEAK)    gc_recurse_weak_mapping(m, gc_mark_weak_svalues);    else    NEW_MAPPING_LOOP(m->data)    { -  gc_mark_svalues(&k->ind, 1); -  gc_mark_svalues(&k->val, 1); +  if (gc_mark_svalues(&k->ind, 1) || +  gc_mark_svalues(&k->val, 1)) { + #ifdef PIKE_DEBUG +  fatal("Looks like check_mapping_for_destruct " +  "didn't do its job properly.\n"); + #endif    }    }    }    } -  + }      void low_gc_cycle_check_mapping(struct mapping *m)   {   #ifdef PIKE_DEBUG    if(m->data->refs <=0)    fatal("Zero refs in mapping->data\n");   #endif       if((m->data->ind_types | m->data->val_types) & BIT_COMPLEX)    {    INT32 e;    struct keypair *k;       if (m->flags & MAPPING_FLAG_WEAK)    gc_recurse_weak_mapping(m, gc_cycle_check_weak_svalues);    else    NEW_MAPPING_LOOP(m->data)    { -  gc_cycle_check_svalues(&k->ind, 1); -  gc_cycle_check_svalues(&k->val, 1); +  if (gc_cycle_check_svalues(&k->ind, 1) || +  gc_cycle_check_svalues(&k->val, 1)) { + #ifdef PIKE_DEBUG +  fatal("Looks like check_mapping_for_destruct " +  "didn't do its job properly.\n"); + #endif    }    }    } -  + }      void real_gc_cycle_check_mapping(struct mapping *m)   {    GC_CYCLE_ENTER(m, 0) {    low_gc_cycle_check_mapping(m);    } GC_CYCLE_LEAVE;   }      void real_gc_cycle_check_mapping_weak(struct mapping *m)   {
pike.git/src/mapping.c:1948:    MAPPING_LOOP(m)    {    /* We do not want to count this key:index pair if    * the index is a destructed object or function    */    if(((1 << k->ind.type) & (BIT_OBJECT | BIT_FUNCTION)) &&    !(k->ind.u.object->prog))    continue;       debug_gc_check_weak_svalues(&k->ind, 1, T_MAPPING, m); -  m->data->val_types |= +     debug_gc_check_weak_svalues(&k->val, 1, T_MAPPING, m);    }    }    else {    MAPPING_LOOP(m)    {    /* We do not want to count this key:index pair if    * the index is a destructed object or function    */    if(((1 << k->ind.type) & (BIT_OBJECT | BIT_FUNCTION)) &&    !(k->ind.u.object->prog))    continue;       debug_gc_check_svalues(&k->ind, 1, T_MAPPING, m); -  m->data->val_types |= +     debug_gc_check_svalues(&k->val, 1, T_MAPPING, m);    }    }    }   }      #ifdef PIKE_DEBUG   unsigned gc_touch_all_mappings(void)   {    unsigned n = 0;