pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: gc.c,v 1.250 2004/04/04 21:54:04 mast Exp $ + || $Id: gc.c,v 1.251 2004/04/06 15:37:55 nilsson Exp $   */      #include "global.h"      struct callback *gc_evaluator_callback=0;      #include "array.h"   #include "multiset.h"   #include "mapping.h"   #include "object.h"
pike.git/src/gc.c:26:   #include "interpret.h"   #include "bignum.h"   #include "pike_threadlib.h"      #include "gc.h"   #include "main.h"   #include <math.h>      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.250 2004/04/04 21:54:04 mast Exp $"); + RCSID("$Id: gc.c,v 1.251 2004/04/06 15:37:55 nilsson Exp $");      int gc_enabled = 1;      /* These defaults are only guesses and hardly tested at all. Please improve. */   double gc_garbage_ratio_low = 0.2;   double gc_time_ratio = 0.05;   double gc_garbage_ratio_high = 0.5;      /* This slowness factor approximately corresponds to the average over    * the last ten gc rounds. (0.9 == 1 - 1/10) */
pike.git/src/gc.c:308:       for(m=first_mapping;m;m=m->next)    if(m==(struct mapping *)something)    return T_MAPPING;    else if (m->data == (struct mapping_data *) something)    return T_MAPPING_DATA;       for(mu=first_multiset;mu;mu=mu->next)    if(mu==(struct multiset *)something)    return T_MULTISET; - #ifdef PIKE_NEW_MULTISETS +     else if (mu->msd == (struct multiset_data *) something)    return T_MULTISET_DATA; - #endif +        if(safe_debug_findstring((struct pike_string *)something))    return T_STRING;       for (i = 0; i < pike_type_hash_size; i++)    for (t = pike_type_hash[i]; t; t = t->next)    if (t == (struct pike_type *) something)    return T_TYPE;       for (c = first_callable; c; c = c->next)
pike.git/src/gc.c:524:       }    }    break;    }       case T_STORAGE:    fprintf(stderr, "%*s **In storage of object\n", indent, "");    break;    - #ifdef PIKE_NEW_MULTISETS +     case T_MULTISET:    descblock = ((struct multiset *) memblock)->msd;    /* FALL THROUGH */       case T_MULTISET_DATA: {    struct multiset_data *msd = (struct multiset_data *) descblock;    union msnode *node = low_multiset_first (msd);    struct svalue ind;    int indval = msd->flags & MULTISET_INDVAL;    for (; node; node = low_multiset_next (node)) {
pike.git/src/gc.c:551: Inside #if defined(PIKE_NEW_MULTISETS)
   else if (indval && &node->iv.val == (struct svalue *) location) {    fprintf(stderr, "%*s **In value with index ", indent, "");    print_svalue(stderr, low_use_multiset_index (node, ind));    fputc('\n', stderr);    break;    }    }    break;    }    - #else /* PIKE_NEW_MULTISETS */ -  case T_MULTISET: -  descblock = ((struct multiset *) memblock)->ind; -  /* FALL THROUGH */ - #endif -  +     case T_ARRAY:    {    struct array *a=(struct array *)descblock;    struct svalue *s=(struct svalue *)location;       if(location == (void *)&a->next)    fprintf(stderr,"%*s **In a->next\n",indent,"");       if(location == (void *)&a->prev)    fprintf(stderr,"%*s **In a->prev\n",indent,"");
pike.git/src/gc.c:1006:    {   #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) \    fprintf(stderr, "%*s* " #NAME " %p[%"PRINTSIZET"u]\n", \    indent, "", p->NAME, p->PIKE_CONCAT(num_,NAME));   #include "program_areas.h"    }       break;    }    - #ifdef PIKE_NEW_MULTISETS +     case T_MULTISET_DATA: {    int found = 0;    struct multiset *l;    for (l = first_multiset; l; l = l->next) {    if (l->msd == (struct multiset_data *) a) {    fprintf(stderr, "%*s**Describing multiset %p for this data block:\n",    indent, "", l);    debug_dump_multiset(l);    found = 1;    }    }    if (!found)    fprintf (stderr, "%*s**Didn't find multiset for this data block!\n", indent, "");    break;    }       case T_MULTISET:    debug_dump_multiset((struct multiset *) a);    break;    - #else /* PIKE_NEW_MULTISETS */ -  case T_MULTISET: -  fprintf(stderr,"%*s**Describing array %p of multiset:\n", -  indent,"", ((struct multiset *)a)->ind); -  debug_dump_array(((struct multiset *)a)->ind); -  break; - #endif -  +     case T_ARRAY:    debug_dump_array((struct array *)a);    break;       case T_MAPPING_DATA:    {    int found = 0;    struct mapping *m;    for(m=first_mapping;m;m=m->next)    {
pike.git/src/gc.c:2897: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    obj_count = delayed_freed;   #endif    Pike_in_gc = GC_PASS_ZAP_WEAK;    /* Zap weak references from external to internal things. That    * doesn't occur very often; only when something have both    * external weak refs and nonweak cyclic refs from internal    * things. */    gc_zap_ext_weak_refs_in_mappings();    gc_zap_ext_weak_refs_in_arrays(); - #ifdef PIKE_NEW_MULTISETS +     gc_zap_ext_weak_refs_in_multisets(); - #else -  /* Multisets handled as arrays. */ - #endif +     gc_zap_ext_weak_refs_in_objects();    gc_zap_ext_weak_refs_in_programs();    GC_VERBOSE_DO(    fprintf(stderr,    "| zap weak: freed %"PRINTPTRDIFFT"d external weak refs, "    "%"PRINTSIZET"u internal still around,\n"    "| %d more things to free\n",    to_free - gc_ext_weak_refs, gc_ext_weak_refs,    delayed_freed - obj_count));    }