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.124 2001/06/04 23:59:56 mast Exp $"); + RCSID("$Id: mapping.c,v 1.125 2001/06/26 21:03:50 hubbe Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "pike_memory.h"   #include "dynamic_buffer.h"   #include "interpret.h"
pike.git/src/mapping.c:2097:    else \    W_REC(&k->ind, 1); /* Now we can recurse the index. */ \   } while (0)      void gc_mark_mapping_as_referenced(struct mapping *m)   {   #ifdef PIKE_DEBUG    if(m->data->refs <=0)    fatal("Zero refs in mapping->data\n");   #endif +  debug_malloc_touch(m); +  debug_malloc_touch(m->data);       if(gc_mark(m)) {    struct mapping_data *md = m->data;       if (m == gc_mark_mapping_pos)    gc_mark_mapping_pos = m->next;    if (m == gc_internal_mapping)    gc_internal_mapping = m->next;    else {    DOUBLEUNLINK(first_mapping, m);
pike.git/src/mapping.c:2146:    md->val_types = val_types;    md->ind_types = ind_types;    }    }   }      void real_gc_cycle_check_mapping(struct mapping *m, int weak)   {    GC_CYCLE_ENTER(m, weak) {    struct mapping_data *md = m->data; +  debug_malloc_touch(m); +  debug_malloc_touch(md);      #ifdef PIKE_DEBUG    if(md->refs <=0)    fatal("Zero refs in mapping->data\n");   #endif       if ((md->ind_types | md->val_types) & BIT_COMPLEX) {    TYPE_FIELD ind_types = 0, val_types = 0;    if (MAPPING_DATA_IN_USE(md)) {    /* Must leave the mapping data untouched if it's busy. */ -  +  debug_malloc_touch(m); +  debug_malloc_touch(md);    GC_RECURSE_MD_IN_USE(md, gc_cycle_check_svalues, ind_types, val_types);    gc_assert_checked_as_nonweak(md);    }    else    switch (md->flags & MAPPING_WEAK) {    case 0: -  +  debug_malloc_touch(m); +  debug_malloc_touch(md);    GC_RECURSE(md, GC_REC_KP, gc_cycle_check, ind_types, val_types);    gc_assert_checked_as_nonweak(md);    break;    case MAPPING_WEAK_INDICES: -  +  debug_malloc_touch(m); +  debug_malloc_touch(md);    GC_RECURSE(md, GC_REC_KP_IND, gc_cycle_check, ind_types, val_types);    gc_assert_checked_as_weak(md);    break;    case MAPPING_WEAK_VALUES: -  +  debug_malloc_touch(m); +  debug_malloc_touch(md);    GC_RECURSE(md, GC_REC_KP_VAL, gc_cycle_check, ind_types, val_types);    gc_assert_checked_as_weak(md);    break;    default: -  +  debug_malloc_touch(m); +  debug_malloc_touch(md);    GC_RECURSE(md, GC_REC_KP_BOTH, gc_cycle_check, ind_types, val_types);    gc_assert_checked_as_weak(md);    break;    }    md->val_types = val_types;    md->ind_types = ind_types;    }    } GC_CYCLE_LEAVE;   }   
pike.git/src/mapping.c:2277:   #endif    }   }      void gc_mark_all_mappings(void)   {    gc_mark_mapping_pos = gc_internal_mapping;    while (gc_mark_mapping_pos) {    struct mapping *m = gc_mark_mapping_pos;    gc_mark_mapping_pos = m->next; +  +  debug_malloc_touch(m); +  debug_malloc_touch(m->data); +     if(gc_is_referenced(m))    gc_mark_mapping_as_referenced(m);    }   }      void gc_cycle_check_all_mappings(void)   {    struct mapping *m;    for (m = gc_internal_mapping; m; m = m->next) {    real_gc_cycle_check_mapping(m, 0);
pike.git/src/mapping.c:2309:    discard_queue(&gc_mark_queue);   }      void gc_free_all_unreferenced_mappings(void)   {    struct mapping *m,*next;    struct mapping_data *md;       for(m=gc_internal_mapping;m;m=next)    { +  debug_malloc_touch(m); +  debug_malloc_touch(m->data); +     if(gc_do_free(m))    {    /* Got an extra ref from gc_cycle_pop(). */    md = m->data; -  +  +  debug_malloc_touch(m); +  debug_malloc_touch(md); +     /* Protect against unlink_mapping_data() recursing too far. */    m->data=&empty_data; -  m->data->refs++; +  add_ref(m->data);       unlink_mapping_data(md);   #ifdef MAPPING_SIZE_DEBUG    m->debug_size=0;   #endif    gc_free_extra_ref(m);    SET_NEXT_AND_FREE(m, free_mapping);    }    else    {