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.309 2008/05/03 21:56:53 nilsson Exp $ + || $Id: gc.c,v 1.310 2008/05/04 04:48:32 mast 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:2373: Inside #if defined(PIKE_DEBUG)
     #ifdef PIKE_DEBUG    if ((Pike_in_gc == GC_PASS_ZAP_WEAK || Pike_in_gc == GC_PASS_COUNT_MEMORY) &&    !find_marker (a))    gc_fatal (a, 0, "gc_mark() called for for thing without marker "    "in pass %d.\n", Pike_in_gc);   #endif       m = get_marker (a);    +  /* Note: m->refs and m->xrefs are useless already here due to how +  * gc_free_(short_)svalue works. */ +    #ifdef PIKE_DEBUG    if (gc_is_watching && m && m->flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_mark()");    }    if (!a) Pike_fatal("Got null pointer.\n");    if (Pike_in_gc != GC_PASS_MARK && Pike_in_gc != GC_PASS_ZAP_WEAK &&    Pike_in_gc != GC_PASS_COUNT_MEMORY)    Pike_fatal("GC mark attempted in invalid pass.\n");    if (!*(INT32 *) a)    gc_fatal(a, 0, "Marked a thing without refs.\n"); -  if (m->refs > *(INT32 *) a) -  /* This ought to be catched already in gc_check(_weak). */ -  gc_fatal (a, 1, "GC check counted %d refs to thing with refcount %d.\n", -  m->refs, *(INT32 *) a); -  if (m->flags & GC_NOT_REFERENCED && m->refs != *(INT32 *) a && -  Pike_in_gc != GC_PASS_COUNT_MEMORY) -  gc_fatal (a, 0, "GC_NOT_REFERENCED set for thing " -  "with refcount %d and counted refs %d.\n", *(INT32 *) a, m->refs); +     if (m->weak_refs < 0 && Pike_in_gc != GC_PASS_COUNT_MEMORY)    gc_fatal(a, 0, "Marking thing scheduled for weak free.\n");   #endif       switch (Pike_in_gc) {    case GC_PASS_ZAP_WEAK:    /* Things are visited in the zap weak pass through the mark    * functions to free refs to internal things that only got weak    * external references. That happens only when a thing also have    * internal cyclic nonweak refs. */
pike.git/src/gc.c:3409: Inside #if defined (PIKE_DEBUG) || defined (DO_PIKE_CLEANUP)
   gc_check_all_objects();   #if defined (PIKE_DEBUG) || defined (DO_PIKE_CLEANUP)    gc_check_all_types();   #endif    } END_ACCEPT_UNFINISHED_TYPE_FIELDS;       GC_VERBOSE_DO(fprintf(stderr, "| check: %u references in %d things, "    "counted %"PRINTSIZET"u weak refs\n",    checked, num_objects, gc_ext_weak_refs));    +  /* Object alloc/free are still disallowed, but refs might be lowered +  * by gc_free_(short_)svalue. */ +     Pike_in_gc=GC_PASS_MARK;       /* Anything after and including gc_internal_* in the linked lists    * are considered to lack external references. The mark pass move    * externally referenced things in front of these pointers. */    gc_internal_array = first_array;    gc_internal_multiset = first_multiset;    gc_internal_mapping = first_mapping;    gc_internal_program = first_program;    gc_internal_object = first_object;