Branch: Tag:

1997-07-19

1997-07-19 20:25:31 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

garbage collector improved

Rev: src/gc.c:1.11
Rev: src/gc.h:1.9
Rev: src/interpret.c:1.43
Rev: src/modules/files/file.c:1.49
Rev: src/modules/files/socket.c:1.13
Rev: src/modules/files/testsuite.in:1.6
Rev: src/program.h:1.17
Rev: src/svalue.c:1.13
Rev: src/svalue.h:1.9

51:   }      #define GC_REFERENCED 1 + #define GC_XREFERENCED 2      struct marker   { -  struct marker *next; -  void *marked; +     INT32 refs; -  + #ifdef DEBUG +  INT32 xrefs; + #endif    INT32 flags; -  +  struct marker *next; +  void *marked;   };      struct marker_chunk
101:    m=new_marker();    m->marked=a;    m->refs=0; + #ifdef DEBUG +  m->xrefs=0; + #endif    m->flags=0;    m->next=hash[hashval];    hash[hashval]=m;
137:    struct marker *m;    m=getmark(a);   #ifdef DEBUG -  if(m->refs > *(INT32 *)a) +  if(m->refs + m->xrefs > *(INT32 *)a)    {    check_for=a; -  +  fatal("Ref counts are wrong (has %d, found %d + %d external)\n", +  *(INT32 *)a, +  m->refs, +  m->xrefs);       gc_check_all_arrays();    gc_check_all_multisets();
155:    return m->refs < *(INT32 *)a;   }    + #ifdef DEBUG + int gc_external_mark(void *a) + { +  struct marker *m; +  if(check_for) +  { +  if(a==check_for) +  { +  gdb_gc_stop_here(a); +  fprintf(stderr,"--External\n"); +  +  return 1; +  } +  return 0; +  } +  m=getmark(a); +  m->xrefs++; +  m->flags|=GC_XREFERENCED; +  gc_is_referenced(a); +  return 0; + } + #endif +    int gc_mark(void *a)   {    struct marker *m;