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.324 2008/08/23 03:58:33 mast Exp $ + || $Id: gc.c,v 1.325 2008/09/30 19:25:16 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:4366:    _list_prev->wl_next = _list_next; \    _list_next->wl_prev = _list_prev; \    DO_IF_DEBUG (_m->wl_prev = (void *) (ptrdiff_t) -1); \    _m->wl_next = NULL; \    } while (0)      static INLINE void mc_wl_enqueue_first (struct mc_marker *m)   {    if (m->wl_next) WL_REMOVE (m);    WL_ADD_FIRST (m); +  assert (mc_pass != MC_PASS_LOOKAHEAD || +  m->wl_next == &mc_work_list || +  m->dist == m->wl_next->dist || +  m->dist == m->wl_next->dist - 1); +  assert (mc_pass != MC_PASS_LOOKAHEAD || +  m->dist == mc_work_list.wl_prev->dist || +  m->dist == mc_work_list.wl_prev->dist - 1);   }      static INLINE void mc_wl_enqueue_last (struct mc_marker *m)   {    /* Note: Does not try to remove from the queue first. */    WL_ADD_LAST (m); -  +  assert (mc_pass != MC_PASS_LOOKAHEAD || +  m->wl_prev == &mc_work_list || +  m->dist == m->wl_prev->dist || +  m->dist == m->wl_prev->dist + 1); +  assert (mc_pass != MC_PASS_LOOKAHEAD || +  m->dist == mc_work_list.wl_next->dist || +  m->dist == mc_work_list.wl_next->dist + 1);   }      static INLINE struct mc_marker *mc_wl_dequeue()   {    struct mc_marker *m = mc_work_list.wl_next;    if (m != &mc_work_list) {    WL_REMOVE (m);    return m;    }    return NULL;
pike.git/src/gc.c:4530:    /* mc_ref_from is a former lookahead thing that has become internal. */    assert (ref_to->la_refs > 0);    ref_to->la_refs--;    ref_to->int_refs++;    }       assert (ref_to->int_refs + ref_to->la_refs <= *(INT32 *) thing);       if (ref_to->int_refs == *(INT32 *) thing) {    /* Found a new internal thing. */ +  assert (cur_dist == 0);    ref_to->flags |= MC_FLAG_INTERNAL;    ref_to->dist = 0;    if (!ref_to_is_new) DL_REMOVE (ref_to);    mc_wl_enqueue_first (ref_to);    MC_DEBUG_MSG (ref_to, "made internal and enqueued");    return;    }    else    MC_DEBUG_MSG (ref_to, "added internal ref");    }
pike.git/src/gc.c:4625:    }    else    MC_DEBUG_MSG (ref_to, "ignored internal");    }   }      PMOD_EXPORT int mc_count_bytes (void *thing)   {    if (mc_pass == MC_PASS_LOOKAHEAD) {    struct mc_marker *m = find_mc_marker (thing); + #ifdef PIKE_DEBUG +  if (!m) Pike_fatal ("mc_marker not found for %p.\n", thing); + #endif    if ((m->flags & (MC_FLAG_INTERNAL|MC_FLAG_MEMCOUNTED)) == MC_FLAG_INTERNAL)    return 1;    }    return 0;   }      /*! @decl int count_memory (int(0..)|mapping(string:int) options, @    *! array|multiset|mapping|object|program|string|type|int... things)    *! @appears Pike.count_memory    *!
pike.git/src/gc.c:4782:       if (Pike_sp[-args].type == T_MAPPING) {    struct mapping *m = Pike_sp[-args].u.mapping;    struct pike_string *ind;    struct svalue *val;       MAKE_CONST_STRING (ind, "lookahead");    if ((val = low_mapping_string_lookup (m, ind))) {    if (val->type != T_INT || val->u.integer < 0)    SIMPLE_ARG_ERROR ("count_memory", 1, -  "\"lookahead\" is not a non-negative integer."); +  "\"lookahead\" is a negative integer.");   #if MAX_INT_TYPE > MAX_UINT32    if (val->u.integer > MAX_UINT32)    mc_lookahead = MAX_UINT32;    else   #endif    mc_lookahead = val->u.integer;    }      #define CHECK_BLOCK_FLAG(NAME, TYPE_BIT) do { \    MAKE_CONST_STRING (ind, NAME); \