pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:4571:   PMOD_EXPORT int mc_pass;   PMOD_EXPORT size_t mc_counted_bytes;      static int mc_lookahead, mc_block_pike_cycle_depth;   static TYPE_FIELD mc_block_lookahead;   static TYPE_FIELD mc_block_lookahead_default = BIT_PROGRAM|BIT_STRING|BIT_TYPE;   /* Strings are blocked because they don't contain refs. Types are    * blocked because they are acyclic and don't contain refs to anything    * but strings and other types. */    + static INLINE int mc_lookahead_blocked(unsigned INT16 type) { +  if (type < sizeof(TYPE_FIELD)*8) { +  return !!(mc_block_lookahead & ((TYPE_FIELD)1 << type)); +  } +  +  return 0; + } +    static int mc_block_strings;      static int mc_enqueued_noninternal;   /* Set whenever something is enqueued in MC_PASS_LOOKAHEAD that isn't    * internal already. This is used to detect whether another    * MC_PASS_MARK_EXTERNAL is necessary. */      static unsigned mc_ext_toggle_bias = 0;      #define MC_PASS_LOOKAHEAD 1
pike.git/src/gc.c:5118:    (ref_to_flags & MC_FLAG_CANDIDATE_REF) &&    ref_to->int_refs + ref_to->la_refs == *(INT32 *) thing) {    assert (!(ref_to_flags & MC_FLAG_CANDIDATE));    assert (ref_to->la_refs > 0);    ref_to_flags |= MC_FLAG_CANDIDATE;    MC_DEBUG_MSG (ref_to, "made candidate");       ref_to->flags = ref_to_flags;    ref_to->la_count = ref_to_la_count;    -  if (mc_block_lookahead & (1 << type_from_visit_fn (visit_fn))) { +  if (mc_lookahead_blocked(type_from_visit_fn (visit_fn))) {    MC_DEBUG_MSG (ref_to, "type is blocked - not enqueued");    return;    }       if (ref_to_la_count > 0) {    /* Always enqueue if the count allows it, even if it hasn't    * increased. That since MC_FLAG_CANDIDATE_REF must be propagated. */    if (ref_to->queuepos != MAX_UINT32 && old_la_count == ref_to_la_count)    MC_DEBUG_MSG (ref_to, "already in queue");    else {
pike.git/src/gc.c:5142:    mc_enqueued_noninternal = 1;    }    }    else    MC_DEBUG_MSG (ref_to, "candidate not enqueued due to zero count");    return;    }       /* Normal handling. */    -  if (mc_block_lookahead & (1 << type_from_visit_fn (visit_fn))) { +  if (mc_lookahead_blocked(type_from_visit_fn (visit_fn))) {    ref_to->flags = ref_to_flags;    ref_to->la_count = ref_to_la_count;    MC_DEBUG_MSG (ref_to, "type is blocked - not enqueued");    return;    }       if (!la_count_handled && !(ref_to_flags & MC_FLAG_LA_COUNT_FIXED)) {    int cycle_depth;    int count_from_source = ref_type & REF_TYPE_INTERNAL ?    mc_ref_from->la_count : mc_ref_from->la_count - 1;
pike.git/src/gc.c:5813:    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) {    TYPE_T type = type_from_visit_fn (m->visit_fn);    assert (!(m->flags & MC_FLAG_INTERNAL));    assert (m->flags & MC_FLAG_LA_VISITED);    assert (list != &mc_incomplete || !(m->flags & MC_FLAG_CANDIDATE)); -  if (mc_block_lookahead & (1 << type)) +  if (mc_lookahead_blocked(type))    MC_DEBUG_MSG (m, "type is blocked - not visiting");    else {   #ifdef MEMORY_COUNT_DEBUG    mc_ref_from = m;    MC_DEBUG_MSG (NULL, "visiting external");   #endif    count_visits++;    count_revisits++;    m->visit_fn (m->thing, VISIT_NORMAL, m->extra);    }
pike.git/src/gc.c:5856:       {    /* We've found some internal cyclic stuff. Put it in the work    * list for the next round. */    struct mc_marker *m = mc_complete.dl_next;    assert (m != &mc_complete);    do {    assert (!(m->flags & (MC_FLAG_INTERNAL | MC_FLAG_INT_VISITED)));    m->flags |= MC_FLAG_INTERNAL;    assert (m->flags & (MC_FLAG_CANDIDATE | MC_FLAG_LA_VISITED)); -  assert (!(mc_block_lookahead & -  (1 << type_from_visit_fn (m->visit_fn)))); +  assert (!(mc_lookahead_blocked(type_from_visit_fn (m->visit_fn))));    /* The following assertion implies that the lookahead count    * already has been raised as it should. */    assert (m->flags & MC_FLAG_CANDIDATE_REF);    mc_wq_enqueue (m);    if (collect_stats && type_from_visit_fn (m->visit_fn) <= MAX_TYPE)    count_cyclic++;    MC_DEBUG_MSG (m, "enqueued cyclic internal");    m = m->dl_next;    } while (m != &mc_complete);    }