Branch: Tag:

2000-07-11

2000-07-11 03:45:10 by Martin Stjernholm <mast@lysator.liu.se>

Fixed bug in gc where things which got only weak refs externally but
non-weak internal cyclic refs didn't get gc'd.

Rev: src/array.c:1.77
Rev: src/gc.c:1.105
Rev: src/gc.h:1.54
Rev: src/mapping.c:1.92
Rev: src/multiset.c:1.24
Rev: src/object.c:1.135
Rev: src/program.c:1.249
Rev: src/queue.c:1.5
Rev: src/queue.h:1.4
Rev: src/svalue.c:1.83
Rev: src/testsuite.in:1.312

5:   \*/   /**/   #include "global.h" - RCSID("$Id: mapping.c,v 1.91 2000/07/06 23:25:26 mast Exp $"); + RCSID("$Id: mapping.c,v 1.92 2000/07/11 03:45:10 mast Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"
846: Inside #if defined(PIKE_DEBUG)
   fatal("Zero refs in mapping->data\n");    if(d_flag>1) check_mapping(m);    debug_malloc_touch(m); -  if (Pike_in_gc > GC_PASS_PREPARE && Pike_in_gc != GC_PASS_MARK) +  if (Pike_in_gc > GC_PASS_PREPARE && Pike_in_gc < GC_PASS_FREE && +  Pike_in_gc != GC_PASS_MARK)    fatal("check_mapping_for_destruct called in wrong pass inside gc.\n");   #endif   
2060:    struct mapping *m,*next;    struct mapping_data *md;    +  if (gc_ext_weak_refs) { +  /* Have to go through all marked things if we got external weak +  * references to otherwise unreferenced things, so the mark +  * functions can free those references. */ +  gc_mark_mapping_pos = first_mapping; +  while (gc_mark_mapping_pos != gc_internal_mapping && gc_ext_weak_refs) { +  struct mapping *m = gc_mark_mapping_pos; +  gc_mark_mapping_pos = m->next; +  gc_mark_mapping_as_referenced(m); +  } +  discard_queue(&gc_mark_queue); +  } +     for(m=gc_internal_mapping;m;m=next)    {    if(gc_do_free(m))