Branch: Tag:

2000-07-18

2000-07-18 05:48:20 by Martin Stjernholm <mast@lysator.liu.se>

Fixed tricky gc problems by implementing a gc-tailored call stack that can
be rotated. That also made the whole thing quite a bit less hairy.

Rev: src/array.c:1.78
Rev: src/array.h:1.21
Rev: src/gc.c:1.107
Rev: src/gc.h:1.55
Rev: src/mapping.c:1.93
Rev: src/mapping.h:1.27
Rev: src/multiset.c:1.25
Rev: src/multiset.h:1.13
Rev: src/object.c:1.136
Rev: src/object.h:1.49
Rev: src/program.c:1.251
Rev: src/program.h:1.96
Rev: src/svalue.c:1.84
Rev: src/testsuite.in:1.314

23:   #include "stuff.h"   #include "bignum.h"    - RCSID("$Id: array.c,v 1.77 2000/07/11 03:45:09 mast Exp $"); + RCSID("$Id: array.c,v 1.78 2000/07/18 05:48:20 mast Exp $");      struct array empty_array=   {
1861:    }   }    - static void low_gc_cycle_check_array(struct array *a) + void real_gc_cycle_check_array(struct array *a, int weak)   { -  +  GC_CYCLE_ENTER(a, weak) {    int e;   #ifdef PIKE_DEBUG    if (a == &empty_array) fatal("Trying to gc cycle check empty_array.\n");
1882:    }    }    } - } -  - void real_gc_cycle_check_array(struct array *a) - { -  GC_CYCLE_ENTER(a, 0) { -  low_gc_cycle_check_array(a); +     } GC_CYCLE_LEAVE;   }    - void real_gc_cycle_check_array_weak(struct array *a) - { -  GC_CYCLE_ENTER(a, 1) { -  low_gc_cycle_check_array(a); -  } GC_CYCLE_LEAVE; - } -  +    #ifdef PIKE_DEBUG   unsigned gc_touch_all_arrays(void)   {
1948:   {    struct array *a;    for (a = gc_internal_array; a != &empty_array; a = a->next) { -  real_gc_cycle_check_array(a); -  run_lifo_queue(&gc_mark_queue); +  real_gc_cycle_check_array(a, 0); +  gc_cycle_run_queue();    }   }    - void gc_free_all_unreferenced_arrays(void) + void gc_zap_ext_weak_refs_in_arrays(void)   { -  struct array *a,*next; -  -  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_array_pos = empty_array.next;    while (gc_mark_array_pos != gc_internal_array && gc_ext_weak_refs) {    struct array *a = gc_mark_array_pos;
1970:    discard_queue(&gc_mark_queue);    }    + void gc_free_all_unreferenced_arrays(void) + { +  struct array *a,*next; +     for (a = gc_internal_array; a != &empty_array; a = next)    {   #ifdef PIKE_DEBUG