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.326 2008/10/04 19:51:32 mast Exp $ + || $Id: gc.c,v 1.327 2008/10/05 00:23:24 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:4621:    return val.u.integer;   }      static void pass_lookahead_visit_ref (void *thing, int ref_type,    visit_thing_fn *visit_fn, void *extra)   {    struct mc_marker *ref_to = find_mc_marker (thing);    int ref_from_flags;    int old_la_count; /* -1 flags new ref_to. */    int new_cand_ref, enqueue = 0; -  unsigned type; +  TYPE_T type;       assert (mc_pass == MC_PASS_LOOKAHEAD);   #ifdef PIKE_DEBUG    assert (mc_ref_from != (void *) (ptrdiff_t) -1);   #endif       ref_from_flags = mc_ref_from->flags;       /* Create mc_marker if necessary. */   
pike.git/src/gc.c:5196:       while ((mc_ref_from = mc_wq_dequeue())) {    int action;       if ((mc_ref_from->flags & (MC_FLAG_INTERNAL|MC_FLAG_MEMCOUNTED)) ==    MC_FLAG_INTERNAL) {    action = VISIT_COUNT_BYTES; /* Memory count this. */    MC_DEBUG_MSG (NULL, "enter with byte counting");       if (return_count || collect_stats || collect_internal) { -  int type = type_from_visit_fn (mc_ref_from->visit_fn); +  TYPE_T type = type_from_visit_fn (mc_ref_from->visit_fn);    if (type <= MAX_TYPE) {    count_internal++;    if (collect_internal) {    Pike_sp->type = type;    Pike_sp->subtype = 0;    Pike_sp->u.ptr = mc_ref_from->thing;    add_ref ((struct ref_dummy *) mc_ref_from->thing);    dmalloc_touch_svalue (Pike_sp);    Pike_sp++;    AGGR_ARR_CHECK (collect_internal, 120);
pike.git/src/gc.c:5264:       for (m = mc_incomplete.dl_next; m != &mc_incomplete; m = m->dl_next)    FLAG_EXTERNAL (m);       list = &mc_incomplete;    while (1) {    /* First go through the incomplete list to visit externals,    * then the indirectly incomplete list where all the new    * indirect externals appear. */    for (m = list->dl_next; m != list; m = m->dl_next) { -  int type = type_from_visit_fn (m->visit_fn); +  TYPE_T type = type_from_visit_fn (m->visit_fn);    if (mc_block_lookahead & (1 << type))    MC_DEBUG_MSG (m, "type blocked - not visiting");    else {    MC_DEBUG_MSG (m, "visiting external");    count_visits++;    m->visit_fn (m->thing, VISIT_NORMAL, m->extra);    }    }    if (list == &mc_incomplete) list = &mc_indirect;    else break;
pike.git/src/gc.c:5374:    INSERT_STAT ("revisits", mc_count_revisits);    INSERT_STAT ("rounds", count_rounds);    INSERT_STAT ("work_queue_alloc", mc_wq_size);    INSERT_STAT ("size", mc_counted_bytes);    }       MAKE_CONST_STRING (ind, "collect_externals");    if ((val = low_mapping_string_lookup (opts, ind)) &&    !UNSAFE_IS_ZERO (val)) {    BEGIN_AGGREGATE_ARRAY (count_visited - count_internal) { -  struct mc_marker *m; -  for (m = mc_incomplete.dl_next; m != &mc_incomplete; m = m->dl_next) +  struct mc_marker *m, *list = &mc_incomplete; +  while (1) { +  /* Collect things from the mc_incomplete and mc_indirect lists. */ +  for (m = list->dl_next; m != list; m = m->dl_next)    if (m->flags & MC_FLAG_REFCOUNTED) { -  int type = type_from_visit_fn (m->visit_fn); +  TYPE_T type = type_from_visit_fn (m->visit_fn);    if (type <= MAX_TYPE) {    Pike_sp->type = type;    Pike_sp->subtype = 0;    Pike_sp->u.ptr = m->thing;    add_ref ((struct ref_dummy *) m->thing);    dmalloc_touch_svalue (Pike_sp);    Pike_sp++;    DO_AGGREGATE_ARRAY (120);    }    } -  +  if (list == &mc_incomplete) list = &mc_indirect; +  else break; +  }    } END_AGGREGATE_ARRAY;    args++;    mapping_string_insert (opts, ind, Pike_sp - 1);    }    }       mc_pass = 0;    visit_ref = NULL;       DL_MAKE_EMPTY (mc_incomplete);