pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:4392: Inside #if defined(PIKE_DEBUG)
   if (gc_evaluator_callback) {    remove_callback(gc_evaluator_callback);    gc_evaluator_callback = NULL;    }   #endif /* PIKE_DEBUG */   }      /* Visit things API */      PMOD_EXPORT visit_ref_cb *visit_ref = NULL; + PMOD_EXPORT visit_enter_cb *visit_enter = NULL; + PMOD_EXPORT visit_leave_cb *visit_leave = NULL;      /* Be careful if extending this with internal types like    * T_MAPPING_DATA and T_MULTISET_DATA; there's code that assumes    * type_from_visit_fn only returns types that fit in a TYPE_FIELD. */   PMOD_EXPORT visit_thing_fn *const visit_fn_from_type[MAX_TYPE + 1] = {    (visit_thing_fn *) (ptrdiff_t) -1,    (visit_thing_fn *) (ptrdiff_t) -1,    (visit_thing_fn *) (ptrdiff_t) -1,    (visit_thing_fn *) (ptrdiff_t) -1,    (visit_thing_fn *) (ptrdiff_t) -1,
pike.git/src/gc.c:5276:    MC_DEBUG_MSG (ref_to, "added really internal ref");    assert (ref_to->int_refs <= *(INT32 *) thing);       if (ref_to->int_refs == *(INT32 *) thing) {    ref_to->flags |= MC_FLAG_INTERNAL;    mc_wq_enqueue (ref_to);    MC_DEBUG_MSG (ref_to, "enqueued internal");    }   }    + static void ignore_visit_enter(void *thing, int type, void *extra) + { + } +  + static void ignore_visit_leave(void *thing, int type, void *extra) + { + } +    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_INT_VISITED)) == MC_FLAG_INTERNAL)    return 1;    }
pike.git/src/gc.c:5601:    if (!mc_work_queue) {    exit_mc_marker_hash();    SIMPLE_OUT_OF_MEMORY_ERROR ("Pike.count_memory",    MC_WQ_START_SIZE * sizeof (mc_work_queue[0]));    }    mc_wq_size = MC_WQ_START_SIZE;    mc_work_queue--; /* Compensate for 1-based indexing. */    mc_wq_used = 1;       assert (!mc_pass); +  assert (visit_enter == NULL);    assert (visit_ref == NULL); -  +  assert (visit_leave == NULL);       free_svalue (&throw_value);    mark_free_svalue (&throw_value);       {    int i;    for (i = -args + 1; i < 0; i++) {    struct svalue *s = Pike_sp + i;       if (TYPEOF(*s) == T_INT)
pike.git/src/gc.c:5686:    assert (mc_complete.dl_prev == &mc_complete);    assert (mc_complete.dl_next == &mc_complete);   #ifdef PIKE_DEBUG    assert (mc_ref_from == (void *) (ptrdiff_t) -1);   #endif       mc_counted_bytes = 0;    count_internal = count_cyclic = count_visited = 0;    count_visits = count_revisits = count_rounds = 0;    +  visit_enter = ignore_visit_enter;    visit_ref = mc_lookahead < 0 ?    current_only_visit_ref : pass_lookahead_visit_ref; -  +  visit_leave = ignore_visit_leave;       do {    count_rounds++;    mc_enqueued_noninternal = 0;      #ifdef MEMORY_COUNT_DEBUG    fprintf (stderr, "[%d] MC_PASS_LOOKAHEAD\n", count_rounds);   #endif    mc_pass = MC_PASS_LOOKAHEAD;   
pike.git/src/gc.c:6007:    DO_AGGREGATE_ARRAY (120);    }    }    } END_AGGREGATE_ARRAY;    args++;    mapping_string_insert (opts, ind, Pike_sp - 1);    }    }       mc_pass = 0; +  visit_enter = NULL;    visit_ref = NULL; -  +  visit_leave = NULL;       DL_MAKE_EMPTY (mc_incomplete);    DL_MAKE_EMPTY (mc_indirect);   #ifdef DO_PIKE_CLEANUP    {    size_t e;    for (e = 0; e < mc_marker_hash_table_size; e++)    while (mc_marker_hash_table[e])    remove_mc_marker (mc_marker_hash_table[e]->thing);    }   #endif    exit_mc_marker_hash();       assert (mc_wq_used == 1);    free (mc_work_queue + 1);    mc_work_queue = NULL;       pop_n_elems (args);    push_ulongest (return_count ? count_internal : mc_counted_bytes);   }