pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:23:   #include "constants.h"   #include "interpret.h"   #include "bignum.h"      #include "gc.h"   #include "main.h"   #include <math.h>      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.157 2001/06/28 19:25:38 hubbe Exp $"); + RCSID("$Id: gc.c,v 1.158 2001/06/29 01:21:52 mast Exp $");      /* Run garbage collect approximately every time    * 20 percent of all arrays, objects and programs is    * garbage.    */      #define GC_CONST 20   #define MIN_ALLOC_THRESHOLD 1000   #define MAX_ALLOC_THRESHOLD 10000000   #define MULTIPLIER 0.9
pike.git/src/gc.c:644:    int t,    int indent,    int depth,    int flags)   {    struct program *p=(struct program *)a;    struct marker *m;       if(depth<0) return;    -  if (Pike_in_gc && (m = find_marker(a))) { +  if (marker_hash_table && (m = find_marker(a))) {    fprintf(stderr,"%*s**Got gc ",indent,"");    describe_marker(m);    }       switch(t)    {    case T_FUNCTION:    if(attempt_to_identify(a) != T_OBJECT)    {    fprintf(stderr,"%*s**Builtin function!\n",indent,"");
pike.git/src/gc.c:895:    }    }    }    describe_something(s->u.refs,s->type,0,2,0);   }      void debug_gc_touch(void *a)   {    struct marker *m;    if (!a) fatal("Got null pointer.\n"); -  m = find_marker(a); +        switch (Pike_in_gc) {    case GC_PASS_PRETOUCH: -  +  m = find_marker(a);    if (m && !(m->flags & GC_PRETOUCHED))    gc_fatal(a, 1, "Thing got an existing but untouched marker.\n");    get_marker(a)->flags |= GC_PRETOUCHED;    break;       case GC_PASS_MIDDLETOUCH: -  +  m = find_marker(a);    if (!m)    gc_fatal(a, 1, "Found a thing without marker.\n");    else if (!(m->flags & GC_PRETOUCHED))    gc_fatal(a, 1, "Thing got an existing but untouched marker.\n");    m->flags |= GC_MIDDLETOUCHED;    break;       case GC_PASS_POSTTOUCH: -  +  m = find_marker(a);    if (!*(INT32 *) a)    gc_fatal(a, 1, "Found a thing without refs.\n");    if (m) {    if (!(m->flags & (GC_PRETOUCHED|GC_MIDDLETOUCHED)))    gc_fatal(a, 2, "An existing but untouched marker found "    "for object in linked lists.\n");    else if (m->flags & GC_LIVE_RECURSE ||    (m->frame && m->frame->frameflags & (GC_WEAK_REF|GC_STRONG_REF)))    gc_fatal(a, 2, "Thing still got flag from recurse list.\n");    else if (m->flags & GC_MARKED)
pike.git/src/gc.c:1134: Inside #if defined(PIKE_DEBUG)
   Pike_in_gc = orig_in_gc;    if(i) exit_gc();    d_flag=tmp;   }   #endif      #ifdef PIKE_DEBUG      void debug_gc_add_extra_ref(void *a)   { -  struct marker *m = get_marker(a); +  struct marker *m; +  +  if (gc_debug) { +  m = find_marker(a); +  if ((!m || !(m->flags & GC_PRETOUCHED)) && +  !safe_debug_findstring((struct pike_string *) a)) +  gc_fatal(a, 0, "Doing gc_add_extra_ref() on invalid object.\n"); +  if (!m) m = get_marker(a); +  } +  else m = get_marker(a); +     if (m->flags & GC_GOT_EXTRA_REF)    gc_fatal(a, 0, "Thing already got an extra gc ref.\n");    m->flags |= GC_GOT_EXTRA_REF;    gc_extra_refs++;    add_ref( (struct ref_dummy *)a);   }      void debug_gc_free_extra_ref(void *a)   { -  struct marker *m = get_marker(a); +  struct marker *m; +  +  if (gc_debug) { +  m = find_marker(a); +  if ((!m || !(m->flags & GC_PRETOUCHED)) && +  !safe_debug_findstring((struct pike_string *) a)) +  gc_fatal(a, 0, "Doing gc_add_extra_ref() on invalid object.\n"); +  if (!m) m = get_marker(a); +  } +  else m = get_marker(a); +     if (!(m->flags & GC_GOT_EXTRA_REF))    gc_fatal(a, 0, "Thing haven't got an extra gc ref.\n");    m->flags &= ~GC_GOT_EXTRA_REF;    gc_extra_refs--;   }         int debug_gc_is_referenced(void *a)   {    struct marker *m;