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.278 2007/03/07 18:41:31 mast Exp $ + || $Id: gc.c,v 1.279 2007/03/31 21:41:34 grubba 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:1173:    if(s->len>77)    {    fprintf(stderr,"%*s** \"%60s\"...\n",indent,"",s->str);    }else{    fprintf(stderr,"%*s** \"%s\"\n",indent,"",s->str);    }    }    break;    }    +  case PIKE_T_TYPE: +  { +  fprintf(stderr, "%*s**type: ", indent, ""); +  simple_describe_type((struct pike_type *)a); +  fprintf(stderr, "\n"); +  break; +  } +     case T_PIKE_FRAME: {    struct pike_frame *f = (struct pike_frame *) a;    do {    if (f->refs <= 0) break;    if (f->current_object) {    struct program *p = f->current_object->prog;    if (p) {    struct identifier *id = ID_FROM_INT(p, f->fun);    INT32 line;    struct pike_string *file;
pike.git/src/gc.c:2924:   #endif    if (gc_debug) {    unsigned n;    Pike_in_gc = GC_PASS_PRETOUCH;    n = gc_touch_all_arrays();    n += gc_touch_all_multisets();    n += gc_touch_all_mappings();    n += gc_touch_all_programs();    n += gc_touch_all_objects();   #ifdef PIKE_DEBUG + #if 0 +  gc_touch_all_types(); + #endif    gc_touch_all_strings();   #endif    if (n != (unsigned) num_objects)    Pike_fatal("Object count wrong before gc; expected %d, got %d.\n", num_objects, n);    GC_VERBOSE_DO(fprintf(stderr, "| pretouch: %u things\n", n));    }       /* First we count internal references */    Pike_in_gc=GC_PASS_CHECK;    gc_ext_weak_refs = 0;
pike.git/src/gc.c:2982:    gc_mark_all_arrays();    gc_mark_run_queue();    gc_mark_all_multisets();    gc_mark_run_queue();    gc_mark_all_mappings();    gc_mark_run_queue();    gc_mark_all_programs();    gc_mark_run_queue();    gc_mark_all_objects();    gc_mark_run_queue(); + #if 0 + #ifdef DEBUG_MALLOC +  gc_mark_all_types(); + #endif /* DEBUG_MALLOC */ + #endif   #ifdef PIKE_DEBUG    if(gc_debug) gc_mark_all_strings();   #endif /* PIKE_DEBUG */    } END_ACCEPT_UNFINISHED_TYPE_FIELDS;       GC_VERBOSE_DO(fprintf(stderr,    "| mark: %u markers referenced, %u weak references freed,\n"    "| %d things to free, "    "got %"PRINTSIZET"u tricky weak refs\n",    marked, weak_freed, delayed_freed, gc_ext_weak_refs));
pike.git/src/gc.c:3013:    * follow the same reference several times, just like in the mark    * pass. */    /* Note: The order between types here is normally not significant,    * but the permuting destruct order tests in the testsuite won't be    * really effective unless objects are handled first. :P */    gc_cycle_check_all_objects();    gc_cycle_check_all_arrays();    gc_cycle_check_all_multisets();    gc_cycle_check_all_mappings();    gc_cycle_check_all_programs(); + #if 0 + #ifdef DEBUG_MALLOC +  gc_cycle_check_all_types(); + #endif + #endif      #ifdef PIKE_DEBUG    if (stack_top != POP2STACK (&sentinel_frame))    Pike_fatal("Frame stack not empty at end of cycle check pass.\n");    if (sentinel_frame.next || list_end != &sentinel_frame)    Pike_fatal("Frame list not empty or inconsistent after cycle check pass.\n");    if (gc_ext_weak_refs != orig_ext_weak_refs)    Pike_fatal("gc_ext_weak_refs changed from %"PRINTSIZET"u "    "to %"PRINTSIZET"u in cycle check pass.\n",    orig_ext_weak_refs, gc_ext_weak_refs);
pike.git/src/gc.c:3071: Inside #if defined(DEBUG_MALLOC)
   size_t i;    struct marker *m;   #endif    Pike_in_gc=GC_PASS_MIDDLETOUCH;    n = gc_touch_all_arrays();    n += gc_touch_all_multisets();    n += gc_touch_all_mappings();    n += gc_touch_all_programs();    n += gc_touch_all_objects();   #ifdef PIKE_DEBUG + #if 0 +  gc_touch_all_types(); + #endif    gc_touch_all_strings();   #endif    if (n != (unsigned) num_objects)    Pike_fatal("Object count wrong in gc; expected %d, got %d.\n", num_objects, n);    get_marker(sentinel_frame.data)->flags |= GC_MIDDLETOUCHED;   #if 0 /* Temporarily disabled - Hubbe */   #ifdef PIKE_DEBUG   #ifdef DEBUG_MALLOC    PTR_HASH_LOOP(marker, i, m)    if (!(m->flags & (GC_MIDDLETOUCHED|GC_WEAK_FREED)) &&
pike.git/src/gc.c:3124:    if (gc_internal_mapping)    unreferenced += gc_free_all_unreferenced_mappings();    if (gc_internal_object)    unreferenced += gc_free_all_unreferenced_objects();    /* Note: gc_free_all_unreferenced_objects needs to have the programs    * around to handle the free (even when they aren't live). So it's    * necessary to free the objects before the programs. */    if (gc_internal_program)    unreferenced += gc_free_all_unreferenced_programs();    + #if 0 + #ifdef DEBUG_MALLOC +  unreferenced += gc_free_all_unreferenced_types(); + #endif + #endif +     /* We might occasionally get things to gc_delayed_free that the free    * calls above won't find. They're tracked in this list. */    while (free_extra_list) {    struct gc_free_extra_frame *next = free_extra_list->fe_next;    union anything u;    u.refs = (INT32 *) free_extra_list->data;    gc_free_extra_ref (u.refs);    free_short_svalue (&u, free_extra_list->type);    FREE_FREE_EXTRA_FRAME (free_extra_list);    free_extra_list = next;
pike.git/src/gc.c:3226: Inside #if 0
   /* Disabled since we can't assume any correlation between the    * marks and the actual blocks in or after GC_PASS_FREE. */    if (gc_debug) {    unsigned n;    Pike_in_gc=GC_PASS_POSTTOUCH;    n = gc_touch_all_arrays();    n += gc_touch_all_multisets();    n += gc_touch_all_mappings();    n += gc_touch_all_programs();    n += gc_touch_all_objects(); +  /* gc_touch_all_types(); */    /* gc_touch_all_strings(); */    if (n != (unsigned) num_objects)    Pike_fatal("Object count wrong after gc; expected %d, got %d.\n", num_objects, n);    GC_VERBOSE_DO(fprintf(stderr, "| posttouch: %u things\n", n));    }   #endif      #ifdef PIKE_DEBUG    if (gc_extra_refs) {    size_t e;