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

5:   \*/   /**/   #include "global.h" - RCSID("$Id: program.c,v 1.250 2000/07/12 12:38:41 grubba Exp $"); + RCSID("$Id: program.c,v 1.251 2000/07/18 05:48:20 mast Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
3586: Inside #if defined(GC2)
   }   }    - void low_gc_cycle_check_program(struct program *p) + void real_gc_cycle_check_program(struct program *p, int weak)   { -  +  GC_CYCLE_ENTER(p, weak) {    int e;       if (p->flags & PROGRAM_AVOID_CHECK)
3602: Inside #if defined(GC2)
   for(e=0;e<p->num_inherits;e++)    {    if(p->inherits[e].parent) -  gc_cycle_check_object(p->inherits[e].parent); +  gc_cycle_check_object(p->inherits[e].parent, 0);       if(e && p->inherits[e].prog) -  gc_cycle_check_program(p->inherits[e].prog); +  gc_cycle_check_program(p->inherits[e].prog, 0);    } - } -  - void real_gc_cycle_check_program(struct program *p) - { -  GC_CYCLE_ENTER(p, 0) { -  low_gc_cycle_check_program(p); +     } GC_CYCLE_LEAVE;   }    - void real_gc_cycle_check_program_weak(struct program *p) - { -  GC_CYCLE_ENTER(p, 1) { -  low_gc_cycle_check_program(p); -  } GC_CYCLE_LEAVE; - } -  +    static void gc_check_program(struct program *p)   {    int e;
3723:   {    struct program *p;    for (p = gc_internal_program; p; p = p->next) { -  real_gc_cycle_check_program(p); -  run_lifo_queue(&gc_mark_queue); +  real_gc_cycle_check_program(p, 0); +  gc_cycle_run_queue();    }   }    - void gc_free_all_unreferenced_programs(void) + void gc_zap_ext_weak_refs_in_programs(void)   { -  struct program *p,*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_program_pos = first_program;    while (gc_mark_program_pos != gc_internal_program && gc_ext_weak_refs) {    struct program *p = gc_mark_program_pos;
3745:    discard_queue(&gc_mark_queue);    }    + void gc_free_all_unreferenced_programs(void) + { +  struct program *p,*next; +     for(p=gc_internal_program;p;p=next)    {    debug_malloc_touch(p);