Branch: Tag:

2008-06-27

2008-06-27 11:33:08 by Henrik Grubbström (Grubba) <grubba@grubba.org>

m_generation() is no more.

Rev: src/builtin.cmod:1.215
Rev: src/encode.c:1.281
Rev: src/mapping.c:1.207
Rev: src/mapping.h:1.70
Rev: src/program.c:1.722
Rev: src/program.h:1.253

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: mapping.c,v 1.206 2008/06/26 09:30:49 grubba Exp $ + || $Id: mapping.c,v 1.207 2008/06/27 11:32:39 grubba Exp $   */      #include "global.h"
205:    md->valrefs=0;    md->hardlinks=0;    md->num_keypairs=size; -  md->generation_cnt = 0; +     }else{    switch (flags & MAPPING_WEAK) {    case 0: md = &empty_data; break;
420:    init_mapping(m, new_size, md->flags);    debug_malloc_touch(m);    new_md=m->data; -  new_md->generation_cnt = md->generation_cnt; +        /* This operation is now 100% atomic - no locking required */    if(md->refs>1)
505:    add_ref(nmd); /* For DMALLOC... */    nmd->valrefs=0;    nmd->hardlinks=0; -  nmd->generation_cnt = md->generation_cnt; +        /* FIXME: What about nmd->flags? */   
755:    * possible to tell the difference. */    assign_svalue (&k->ind, key);    assign_svalue(& k->val, val); -  md->flags |= MAPPING_DIRTY; +    #ifdef PIKE_DEBUG    if(d_flag>1) check_mapping(m);   #endif
804:    m->debug_size++;   #endif    -  md->flags |= MAPPING_DIRTY; -  +    #ifdef PIKE_DEBUG    if(d_flag>1) check_mapping(m);   #endif
925:    md->ind_types |= 1 << key->type;    md->val_types |= BIT_INT;    md->size++; -  md->flags |= MAPPING_DIRTY; +    #ifdef MAPPING_SIZE_DEBUG    if(m->data ==md)    m->debug_size++;
1010:    if(md->size < (md->hashsize + 1) * MIN_LINK_LENGTH)    {    debug_malloc_touch(m); -  rehash(m, MAP_SLOTS(m->data->size + !!md->generation_cnt)); -  if (m->data->hashsize) -  m->data->flags |= MAPPING_DIRTY; +  rehash(m, MAP_SLOTS(m->data->size));    } -  else -  md->flags |= MAPPING_DIRTY; +       #ifdef PIKE_DEBUG    if(d_flag>1) check_mapping(m);
1067:    mark_free_svalue (&md->free_list->val);    md->size--;    -  md->flags |= MAPPING_DIRTY; -  +    #ifdef MAPPING_SIZE_DEBUG    if(m->data ==md)    {
1088:    md->val_types = val_types;    md->ind_types = ind_types;    -  if(MAP_SLOTS(md->size + !!md->generation_cnt) < -  md->hashsize * MIN_LINK_LENGTH) +  if(MAP_SLOTS(md->size) < md->hashsize * MIN_LINK_LENGTH)    {    debug_malloc_touch(m); -  rehash(m, MAP_SLOTS(md->size + !!md->generation_cnt)); +  rehash(m, MAP_SLOTS(md->size));    }      #ifdef PIKE_DEBUG
1359:    PREPARE_FOR_DATA_CHANGE();    assign_svalue(& k->val, to);    md->val_types|=1<<to->type; -  md->flags |= MAPPING_DIRTY; +     }    }    free_mapping_data(md);
2218:    to->u.integer=0;   }    - PMOD_EXPORT INT32 mapping_generation(struct mapping *m) - { -  if (m->data->flags & MAPPING_DIRTY) { -  m->data->generation_cnt++; -  m->data->flags &= ~MAPPING_DIRTY; -  } -  return m->data->generation_cnt; - } -  +    #ifdef PIKE_DEBUG      void check_mapping(const struct mapping *m)