pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:165:   #define GC_VERBOSE_DO(X) X   #else   #define GC_VERBOSE_DO(X)   #endif      int num_objects = 2; /* Account for *_empty_array. */   int got_unlinked_things;   ALLOC_COUNT_TYPE num_allocs =0;   ALLOC_COUNT_TYPE alloc_threshold = GC_MIN_ALLOC_THRESHOLD;   PMOD_EXPORT int Pike_in_gc = 0; - unsigned INT32 gc_generation = 1; + unsigned INT16 gc_generation = 1;   time_t last_gc;   int gc_trace = 0, gc_debug = 0;   #ifdef DO_PIKE_CLEANUP   int gc_destruct_everything = 0;   #endif   size_t gc_ext_weak_refs;      ALLOC_COUNT_TYPE saved_alloc_threshold;   /* Used to backup alloc_threshold if the gc is disabled, so that it    * can be restored when it's enabled again. This is to not affect the
pike.git/src/gc.c:1712:    }    }    }    describe_something(s->u.refs, TYPEOF(*s), 0, 1, 0, 0);   }      PMOD_EXPORT void gc_watch(void *a)   {    struct marker *m;    m = get_marker(a); -  if (!(m->flags & GC_WATCHED)) { -  m->flags |= GC_WATCHED; +  if (!(m->gc_flags & GC_WATCHED)) { +  m->gc_flags |= GC_WATCHED;    fprintf(stderr, "## Watching thing %p.\n", a);    gc_is_watching++;    }    else    fprintf(stderr, "## Already watching thing %p.\n", a);   }      static void gc_watched_found (struct marker *m, const char *found_in)   {    fprintf(stderr, "## Watched thing found in "
pike.git/src/gc.c:1801:   {    struct gc_queue_block *b;      #ifdef PIKE_DEBUG    if (Pike_in_gc != GC_PASS_MARK && Pike_in_gc != GC_PASS_ZAP_WEAK)    gc_fatal (data, 0, "gc_mark_enqueue() called in invalid gc pass.\n");    if (gc_found_in_type == PIKE_T_UNKNOWN || !gc_found_in)    gc_fatal (data, 0, "gc_mark_enqueue() called outside GC_ENTER.\n");    {    struct marker *m; -  if (gc_is_watching && (m = find_marker(data)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(data)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_mark_enqueue()");    }    }   #endif       b=gc_mark_last;    if(!b || b->used >= GC_QUEUE_ENTRIES)    {    b = (struct gc_queue_block *) malloc (sizeof (struct gc_queue_block));
pike.git/src/gc.c:1838:   }      #endif /* GC_MARK_DEBUG */      void debug_gc_touch(void *a)   {    struct marker *m;      #ifdef PIKE_DEBUG    if (!a) Pike_fatal("Got null pointer.\n"); -  if (gc_is_watching && (m = find_marker(a)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(a)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_touch()");    }   #endif       switch (Pike_in_gc) {    case GC_PASS_PRETOUCH:    m = find_marker(a);   #ifdef PIKE_DEBUG    if (   #ifdef DO_PIKE_CLEANUP    !gc_keep_markers &&   #endif -  m && !(m->flags & (GC_PRETOUCHED|GC_WATCHED ))) +  m && !(m->gc_flags & (GC_PRETOUCHED|GC_WATCHED )))    gc_fatal(a, 1, "Thing got an existing but untouched marker.\n");   #endif /* PIKE_DEBUG */    m = get_marker(a); -  m->flags |= GC_PRETOUCHED; +  m->gc_flags |= GC_PRETOUCHED;   #ifdef PIKE_DEBUG    m->saved_refs = *(INT32 *) a;   #endif    break;       case GC_PASS_POSTTOUCH: {   #ifdef PIKE_DEBUG    int extra_ref;   #endif    m = find_marker(a);   #ifdef PIKE_DEBUG    if (!m)    gc_fatal(a, 1, "Found a thing without marker.\n"); -  else if (!(m->flags & GC_PRETOUCHED)) +  else if (!(m->gc_flags & GC_PRETOUCHED))    gc_fatal(a, 1, "Thing got an existing but untouched marker.\n"); -  if (gc_destruct_everything && (m->flags & GC_MARKED)) +  if (gc_destruct_everything && (m->gc_flags & GC_MARKED))    gc_fatal (a, 1, "Thing got marked in gc_destruct_everything mode.\n"); -  extra_ref = (m->flags & GC_GOT_EXTRA_REF) == GC_GOT_EXTRA_REF; +  extra_ref = (m->gc_flags & GC_GOT_EXTRA_REF) == GC_GOT_EXTRA_REF;    if (m->saved_refs + extra_ref < *(INT32 *) a) -  if (m->flags & GC_WEAK_FREED) +  if (m->gc_flags & GC_WEAK_FREED)    gc_fatal(a, 1, "Something failed to remove weak reference(s) to thing, "    "or it has gotten more references since gc start.\n");    else    gc_fatal(a, 1, "Thing has gotten more references since gc start.\n");    else    if (m->weak_refs > m->saved_refs)    gc_fatal(a, 0, "A thing got more weak references than references.\n");   #endif -  m->flags |= GC_POSTTOUCHED; +  m->gc_flags |= GC_POSTTOUCHED;    break;    }       default:    Pike_fatal("debug_gc_touch() used in invalid gc pass.\n");    }   }      #ifdef PIKE_DEBUG   
pike.git/src/gc.c:1948:   #endif /* PIKE_DEBUG */      PMOD_EXPORT INT32 real_gc_check(void *a)   {    struct marker *m;    INT32 ret;      #ifdef PIKE_DEBUG    if (gc_found_in_type == PIKE_T_UNKNOWN || !gc_found_in)    gc_fatal (a, 0, "gc_check() called outside GC_ENTER.\n"); -  if (gc_is_watching && (m = find_marker(a)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(a)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_check()");    }    if (!(m = gc_check_debug(a, 0))) return 0;   #else    m = get_marker(a);   #endif       ret=m->gc_refs++;    if (m->gc_refs == *(INT32 *) a) -  m->flags |= GC_NOT_REFERENCED; +  m->gc_flags |= GC_NOT_REFERENCED;    return ret;   }      PMOD_EXPORT INT32 real_gc_check_weak(void *a)   {    struct marker *m;    INT32 ret;      #ifdef PIKE_DEBUG    if (gc_found_in_type == PIKE_T_UNKNOWN || !gc_found_in)    gc_fatal (a, 0, "gc_check_weak() called outside GC_ENTER.\n"); -  if (gc_is_watching && (m = find_marker(a)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(a)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_check_weak()");    }    if (!(m = gc_check_debug(a, 1))) return 0;    if (m->weak_refs < 0)    gc_fatal(a, 1, "Thing has already reached threshold for weak free.\n");    if (m->weak_refs >= *(INT32 *) a)    gc_fatal(a, 1, "Thing has gotten more weak refs than refs.\n");    if (m->weak_refs > m->gc_refs + 1)    gc_fatal(a, 1, "Thing has gotten more weak refs than internal refs.\n");
pike.git/src/gc.c:1993:    m = get_marker(a);   #endif       m->weak_refs++;    gc_ext_weak_refs++;    if (m->weak_refs == *(INT32 *) a)    m->weak_refs = -1;       ret=m->gc_refs++;    if (m->gc_refs == *(INT32 *) a) -  m->flags |= GC_NOT_REFERENCED; +  m->gc_flags |= GC_NOT_REFERENCED;    return ret;   }      static void cleanup_markers (void)   {   }      void exit_gc(void)   {    if (gc_evaluator_callback) {
pike.git/src/gc.c:2027: Inside #if defined(PIKE_DEBUG)
   gc_is_watching = 0;    }   #endif   }      #ifdef PIKE_DEBUG      PMOD_EXPORT void gc_check_zapped (void *a, TYPE_T type, const char *file, INT_TYPE line)   {    struct marker *m = find_marker (a); -  if (m && (m->flags & GC_CLEANUP_LEAKED)) +  if (m && (m->gc_flags & GC_CLEANUP_LEAKED))    fprintf (stderr, "Free of leaked %s %p from %s:%ld, %d refs remaining\n",    get_name_of_type (type), a, file, (long)line, *(INT32 *)a - 1);   }      /* This function marks some known externals. The rest are handled by    * callbacks added with add_gc_callback. */   static void mark_externals (void)   {    struct mapping *constants;    if (master_object)
pike.git/src/gc.c:2093: Inside #if defined(PIKE_DEBUG)
      Pike_in_gc = orig_in_gc;    gc_found_place = orig_gc_found_place;    d_flag=tmp;   }      void debug_gc_add_extra_ref(void *a)   {    struct marker *m;    -  if (gc_is_watching && (m = find_marker(a)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(a)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_add_extra_ref()");    }       if (gc_debug) {    m = find_marker(a); -  if ((!m || !(m->flags & GC_PRETOUCHED)) && +  if ((!m || !(m->gc_flags & GC_PRETOUCHED)) &&    !safe_debug_findstring((struct pike_string *) a))    gc_fatal(a, 0, "Doing gc_add_extra_ref() on invalid object.\n");    if (!m) m = get_marker(a);    }    else m = get_marker(a);    -  if (m->flags & GC_GOT_EXTRA_REF) +  if (m->gc_flags & GC_GOT_EXTRA_REF)    gc_fatal(a, 0, "Thing already got an extra gc ref.\n"); -  m->flags |= GC_GOT_EXTRA_REF; +  m->gc_flags |= GC_GOT_EXTRA_REF;    gc_extra_refs++;    add_ref( (struct ref_dummy *)a);   }      void debug_gc_free_extra_ref(void *a)   {    struct marker *m;    -  if (gc_is_watching && (m = find_marker(a)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(a)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_free_extra_ref()");    }       if (gc_debug) {    m = find_marker(a); -  if ((!m || !(m->flags & GC_PRETOUCHED)) && +  if ((!m || !(m->gc_flags & GC_PRETOUCHED)) &&    !safe_debug_findstring((struct pike_string *) a))    gc_fatal(a, 0, "Doing gc_add_extra_ref() on invalid object.\n");    if (!m) m = get_marker(a);    }    else m = get_marker(a);    -  if (!(m->flags & GC_GOT_EXTRA_REF)) +  if (!(m->gc_flags & GC_GOT_EXTRA_REF))    gc_fatal(a, 0, "Thing haven't got an extra gc ref.\n"); -  m->flags &= ~GC_GOT_EXTRA_REF; +  m->gc_flags &= ~GC_GOT_EXTRA_REF;    gc_extra_refs--;   }         int debug_gc_is_referenced(void *a)   {    struct marker *m;    -  if (gc_is_watching && (m = find_marker(a)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(a)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_is_referenced()");    }       if (!a) Pike_fatal("Got null pointer.\n");    if (Pike_in_gc != GC_PASS_MARK)    Pike_fatal("gc_is_referenced() called in invalid gc pass.\n");       if (gc_debug) {    m = find_marker(a); -  if ((!m || !(m->flags & GC_PRETOUCHED)) && +  if ((!m || !(m->gc_flags & GC_PRETOUCHED)) &&    !safe_debug_findstring((struct pike_string *) a))    gc_fatal(a, 0, "Doing gc_is_referenced() on invalid object.\n");    if (!m) m = get_marker(a);    }    else m = get_marker(a);    -  if (m->flags & GC_IS_REFERENCED) +  if (m->gc_flags & GC_IS_REFERENCED)    gc_fatal(a, 0, "gc_is_referenced() called twice for thing.\n"); -  m->flags |= GC_IS_REFERENCED; +  m->gc_flags |= GC_IS_REFERENCED;    -  return !(m->flags & GC_NOT_REFERENCED); +  return !(m->gc_flags & GC_NOT_REFERENCED);   }      int gc_mark_external (void *a, const char *place)   {    struct marker *m;    -  if (gc_is_watching && (m = find_marker(a)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(a)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_mark_external()");    }       if (!a) Pike_fatal("Got null pointer.\n");       if(Pike_in_gc == GC_PASS_LOCATE)    {    if(a==check_for) {    const char *orig_gc_found_place = gc_found_place;
pike.git/src/gc.c:2204: Inside #if defined(PIKE_DEBUG) and #if defined(DEBUG_MALLOC)
   if (gc_external_refs_zapped) {    fprintf (stderr, "One external ref to %p found%s.\n",    a, place ? place : "");    if (gc_found_in) describe (gc_found_in);    return 0;    }   #endif       m=get_marker(a);    m->xrefs++; -  m->flags|=GC_XREFERENCED; +  m->gc_flags|=GC_XREFERENCED;    if(Pike_in_gc == GC_PASS_CHECK &&    (m->gc_refs + m->xrefs > *(INT32 *)a ||    (m->saved_refs != -1 && m->saved_refs != *(INT32 *)a)))    gc_fatal(a, 1, "Ref counts are wrong.\n");    return 0;   }      #define LOW_CHECK_REC_FRAME(f, file, line) do { \    if (f->rf_flags & GC_FRAME_FREED) \    dloc_gc_fatal (file, line, f->data, 0, \
pike.git/src/gc.c:2378:   #define CHECK_CYCLE_PIECE_FRAME(f) do {} while (0)   #define CHECK_KILL_LIST_FRAME(f) do {} while (0)   #define CHECK_REC_STACK(p1, p1n, p2, p2n) do {} while (0)   #endif /* !PIKE_DEBUG */      int gc_do_weak_free(void *a)   {    struct marker *m;      #ifdef PIKE_DEBUG -  if (gc_is_watching && (m = find_marker(a)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(a)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_do_weak_free()");    }    if (!a) Pike_fatal("Got null pointer.\n");    if (Pike_in_gc != GC_PASS_MARK && Pike_in_gc != GC_PASS_ZAP_WEAK)    Pike_fatal("gc_do_weak_free() called in invalid gc pass.\n");    if (gc_debug) {    if (!(m = find_marker(a)))    gc_fatal(a, 0, "gc_do_weak_free() got unknown object.\n");    }
pike.git/src/gc.c:2403:    gc_fatal(a, 0, "More weak references than internal references.\n");   #else    m = get_marker(a);   #endif       if (Pike_in_gc != GC_PASS_ZAP_WEAK) {    if (m->weak_refs < 0)    goto should_free;    }    else -  if (!(m->flags & GC_MARKED)) { +  if (!(m->gc_flags & GC_MARKED)) {   #ifdef PIKE_DEBUG    if (m->weak_refs <= 0)    gc_fatal(a, 0, "Too many weak refs cleared to thing with external "    "weak refs.\n");   #endif    m->weak_refs--;    goto should_free;    }    return 0;      should_free:    gc_ext_weak_refs--;   #ifdef PIKE_DEBUG    m->saved_refs--; -  m->flags |= GC_WEAK_FREED; +  m->gc_flags |= GC_WEAK_FREED;   #endif       if (*(INT32 *) a == 1) {    /* Make sure the thing doesn't run out of refs, since we can't    * handle cascading frees now. We'll do it in the free pass    * instead. */    gc_add_extra_ref(a); -  m->flags |= GC_GOT_DEAD_REF; +  m->gc_flags |= GC_GOT_DEAD_REF;   #ifdef PIKE_DEBUG    delayed_freed++;   #endif    }       return 1;   }      void gc_delayed_free(void *a, int type)   {    struct marker *m;      #ifdef PIKE_DEBUG -  if (gc_is_watching && (m = find_marker(a)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(a)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_delayed_free()");    }    if (Pike_in_gc != GC_PASS_MARK && Pike_in_gc != GC_PASS_CYCLE &&    Pike_in_gc != GC_PASS_ZAP_WEAK)    Pike_fatal("gc_delayed_free() called in invalid gc pass.\n");    if (gc_debug) {    if (!(m = find_marker(a)))    gc_fatal(a, 0, "gc_delayed_free() got unknown object (missed by pretouch pass).\n");    }    else m = get_marker(a);    if (*(INT32 *) a != 1)    Pike_fatal("gc_delayed_free() called for thing that haven't got a single ref.\n");    debug_malloc_touch(a);    delayed_freed++;   #else    m = get_marker(a);   #endif    -  if (m->flags & GC_MARKED) { +  if (m->gc_flags & GC_MARKED) {    /* Note that we can get marked things here, e.g. if the index in a    * mapping with weak indices is removed in the zap weak pass, the    * value will be zapped too, but it will still have a mark from    * the mark pass. This means that the stuff referenced by the    * value will only be refcount garbed, which can leave cyclic    * garbage for the next gc round.    *    * Since the value has been marked we won't find it in the free    * pass, so we have to keep special track of it. :P */    struct free_extra_frame *l = alloc_free_extra_frame();    l->data = a;    l->type = type;    l->next = free_extra_list;    free_extra_list = l;    }       gc_add_extra_ref(a); -  m->flags |= GC_GOT_DEAD_REF; +  m->gc_flags |= GC_GOT_DEAD_REF;   }      int real_gc_mark(void *a DO_IF_DEBUG (COMMA int type))   {    struct marker *m;      #ifdef PIKE_DEBUG    if (Pike_in_gc == GC_PASS_ZAP_WEAK && !find_marker (a))    gc_fatal_2 (a, type, 0, "gc_mark() called for for thing without marker "    "in zap weak pass.\n");   #endif       m = get_marker (a);       /* Note: m->gc_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) { +  if (gc_is_watching && m && m->gc_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_fatal("GC mark attempted in invalid pass.\n");    if (!*(INT32 *) a)    gc_fatal_2 (a, type, 1, "Marked a thing without refs.\n");    if (m->weak_refs < 0)    gc_fatal_2 (a, type, 1, "Marked a thing scheduled for weak free.\n");   #endif       if (Pike_in_gc == 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. */   #ifdef PIKE_DEBUG -  if (!(m->flags & GC_MARKED)) +  if (!(m->gc_flags & GC_MARKED))    gc_fatal_2 (a, type, 0, "gc_mark() called for thing in zap weak pass "    "that wasn't marked before.\n");   #endif -  if (m->flags & GC_FREE_VISITED) { +  if (m->gc_flags & GC_FREE_VISITED) {    debug_malloc_touch (a);    return 0;    }    else {    debug_malloc_touch (a); -  m->flags |= GC_FREE_VISITED; +  m->gc_flags |= GC_FREE_VISITED;    return 1;    }    }    -  else if (m->flags & GC_MARKED) { +  else if (m->gc_flags & GC_MARKED) {    debug_malloc_touch (a);   #ifdef PIKE_DEBUG    if (m->weak_refs != 0)    gc_fatal_2 (a, type, 0, "weak_refs changed in marker "    "already visited by gc_mark().\n");   #endif    return 0;    }       else {    debug_malloc_touch (a);    if (m->weak_refs) {    gc_ext_weak_refs -= m->weak_refs;    m->weak_refs = 0;    } -  m->flags = (m->flags & ~GC_NOT_REFERENCED) | GC_MARKED; +  m->gc_flags = (m->gc_flags & ~GC_NOT_REFERENCED) | GC_MARKED;    DO_IF_DEBUG(marked++);    return 1;    }   }      void gc_move_marker (void *old, void *new)   {    struct marker *m = find_marker (old);      #ifdef PIKE_DEBUG
pike.git/src/gc.c:2576:       move_marker (m, debug_malloc_pass (new));   }      PMOD_EXPORT void gc_cycle_enqueue(gc_cycle_check_cb *checkfn, void *data, int weak)   {    struct link_frame *l = alloc_link_frame();   #ifdef PIKE_DEBUG    {    struct marker *m; -  if (gc_is_watching && (m = find_marker(data)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(data)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_cycle_enqueue()");    }    }    if (Pike_in_gc != GC_PASS_CYCLE)    gc_fatal(data, 0, "Use of the gc frame stack outside the cycle check pass.\n");    if (stack_top == &sentinel_frame)    gc_fatal (data, 0, "No thing on rec stack to follow links from.\n");   #endif    l->data = data;
pike.git/src/gc.c:2760:   #endif       return beg;   }      int gc_cycle_push(void *data, struct marker *m, int weak)   {    struct marker *pm;      #ifdef PIKE_DEBUG -  if (gc_is_watching && m && m->flags & GC_WATCHED) { +  if (gc_is_watching && m && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_cycle_push()");    }       debug_malloc_touch (data);       if (!data) Pike_fatal ("Got null pointer.\n");    if (Pike_in_gc != GC_PASS_CYCLE)    Pike_fatal("GC cycle push attempted in invalid pass.\n"); -  if (gc_debug && !(m->flags & GC_PRETOUCHED)) +  if (gc_debug && !(m->gc_flags & GC_PRETOUCHED))    gc_fatal (data, 0, "gc_cycle_push() called for untouched thing.\n");    if (!gc_destruct_everything) { -  if ((!(m->flags & GC_NOT_REFERENCED) || m->flags & GC_MARKED) && +  if ((!(m->gc_flags & GC_NOT_REFERENCED) || m->gc_flags & GC_MARKED) &&    *(INT32 *) data)    gc_fatal (data, 1, "Got a referenced marker to gc_cycle_push.\n"); -  if (m->flags & GC_XREFERENCED) +  if (m->gc_flags & GC_XREFERENCED)    gc_fatal (data, 1, "Doing cycle check in externally referenced thing "    "missed in mark pass.\n");    }    if (weak && stack_top == &sentinel_frame)    gc_fatal (data, 1, "weak is %d when stack is empty.\n", weak);    if (gc_debug > 1) {    struct array *a;    struct object *o;    struct program *p;    struct mapping *m;
pike.git/src/gc.c:2807: Inside #if defined(PIKE_DEBUG)
   if(l == (struct multiset *) data) goto on_gc_internal_lists;    gc_fatal (data, 0, "gc_cycle_check() called for thing not on gc_internal lists.\n");    on_gc_internal_lists:    ; /* We must have a least one expression after a label! - Hubbe */    }   #endif       if (stack_top->rf_flags & GC_MARK_LIVE) {    /* Only recurse through things already handled; we'll get to the    * other later in the normal recursion. */ -  if (m->flags & GC_CYCLE_CHECKED && !(m->flags & GC_LIVE)) { +  if (m->gc_flags & GC_CYCLE_CHECKED && !(m->gc_flags & GC_LIVE)) {    CYCLE_DEBUG_MSG (m->frame, "gc_cycle_push, mark live");    goto mark_live;    }    CYCLE_DEBUG_MSG (m->frame, "gc_cycle_push, no mark live");    return 0;    }       if (stack_top == &sentinel_frame)    pm = NULL;    else {
pike.git/src/gc.c:3001:    CYCLE_DEBUG_MSG (r, "> gc_cycle_push, mark cycle 1");    if (r == bottom) break;    }    }    CHECK_REC_STACK (cycle_frame, "cycle_frame", break_pos, "break_pos");    }    }    }       else -  if (!(m->flags & GC_CYCLE_CHECKED)) { +  if (!(m->gc_flags & GC_CYCLE_CHECKED)) {    struct gc_rec_frame *r;   #ifdef PIKE_DEBUG    cycle_checked++;    if (m->frame)    gc_fatal (data, 0, "Marker already got a frame.\n");   #endif    -  m->flags |= GC_CYCLE_CHECKED | (pm ? pm->flags & GC_LIVE : 0); +  m->gc_flags |= GC_CYCLE_CHECKED | (pm ? pm->gc_flags & GC_LIVE : 0);    m->frame = r = gc_cycle_enqueue_rec (data);    debug_malloc_touch (data);    if (weak) {    if (weak > 0) r->rf_flags = GC_PREV_WEAK;    else r->rf_flags = GC_PREV_STRONG;    }    else    r->rf_flags = 0;      #ifdef GC_CYCLE_DEBUG
pike.git/src/gc.c:3031: Inside #if defined(GC_CYCLE_DEBUG)
   else if (weak < 0) CYCLE_DEBUG_MSG (r, "gc_cycle_push, recurse strong");    else CYCLE_DEBUG_MSG (r, "gc_cycle_push, recurse");    gc_cycle_indent += 2;   #endif    CHECK_REC_STACK (NULL, NULL, NULL, NULL);    return 1;    }       /* Should normally not recurse now, but got to do that anyway if we    * must propagate GC_LIVE flags. */ -  if (!pm || !(pm->flags & GC_LIVE) || m->flags & GC_LIVE) { +  if (!pm || !(pm->gc_flags & GC_LIVE) || m->gc_flags & GC_LIVE) {    CYCLE_DEBUG_MSG (m->frame ? m->frame : NULL, "gc_cycle_push, no recurse");    return 0;    }       /* Initialize mark live recursion. */    gc_cycle_enqueue_rec (NULL)->rf_flags = GC_MARK_LIVE;   #ifdef GC_CYCLE_DEBUG    CYCLE_DEBUG_MSG (m->frame ? m->frame : NULL, "gc_cycle_push, mark live begins");    gc_cycle_indent += 2;   #endif      mark_live:   #ifdef PIKE_DEBUG -  if (m->flags & GC_LIVE) +  if (m->gc_flags & GC_LIVE)    Pike_fatal("Shouldn't mark live recurse when there's nothing to do.\n");   #endif -  m->flags |= GC_LIVE; +  m->gc_flags |= GC_LIVE;    debug_malloc_touch (data);    -  if (m->flags & GC_GOT_DEAD_REF) { +  if (m->gc_flags & GC_GOT_DEAD_REF) {    /* A thing previously popped as dead is now being marked live.    * Have to remove the extra ref added by gc_cycle_pop(). */    gc_free_extra_ref (data);    if (!sub_ref ((struct ref_dummy *) data)) {   #ifdef PIKE_DEBUG    gc_fatal (data, 0, "Thing got zero refs after removing the dead gc ref.\n");   #endif    }    }   
pike.git/src/gc.c:3095:    stack_top = r;    }       else {    struct gc_rec_frame *popped = stack_top;      #ifdef PIKE_DEBUG    {    void *data = popped->data;    struct marker *m = find_marker (data); -  if (gc_is_watching && m && m->flags & GC_WATCHED) { +  if (gc_is_watching && m && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_cycle_pop()");    } -  if (!(m->flags & GC_CYCLE_CHECKED)) +  if (!(m->gc_flags & GC_CYCLE_CHECKED))    gc_fatal (data, 0, "Marker being popped doesn't have GC_CYCLE_CHECKED.\n");    if (!gc_destruct_everything) { -  if ((!(m->flags & GC_NOT_REFERENCED) || m->flags & GC_MARKED) && +  if ((!(m->gc_flags & GC_NOT_REFERENCED) || m->gc_flags & GC_MARKED) &&    *(INT32 *) data)    gc_fatal (data, 1, "Got a referenced marker to gc_cycle_pop.\n"); -  if (m->flags & GC_XREFERENCED) +  if (m->gc_flags & GC_XREFERENCED)    gc_fatal (data, 1, "Doing cycle check in externally referenced thing "    "missed in mark pass.\n");    }    if (popped->next != (struct gc_rec_frame *) (ptrdiff_t) -1)    gc_fatal (data, 0, "Popped rec frame got stuff in the next pointer.\n");    }   #endif       stack_top = popped->prev;   #ifdef PIKE_DEBUG
pike.git/src/gc.c:3183: Inside #if defined(PIKE_DEBUG)
   CHECK_CYCLE_PIECE_FRAME (r);    }   #endif       CYCLE_DEBUG_MSG (popped, "gc_cycle_pop, popping cycle");       do {    struct marker *m = find_marker (popped->data);    struct gc_rec_frame *next = popped->cycle_piece;    -  if (m->flags & GC_LIVE_OBJ) { +  if (m->gc_flags & GC_LIVE_OBJ) {    /* Move to the kill list. */   #ifdef PIKE_DEBUG    popped->rf_flags &= ~GC_ON_CYCLE_PIECE_LIST;    popped->cycle_piece = popped->u.last_cycle_piece =    (struct gc_rec_frame *) (ptrdiff_t) -1;   #endif    popped->next = *kill_list_ptr;    *kill_list_ptr = popped;    kill_list_ptr = &popped->next;    popped->rf_flags |= GC_ON_KILL_LIST;       /* Ensure that the frames on the kill list have a valid    * cycle id frame and that every frame is linked directly to    * it. This is only for the sake of warn_bad_cycles. */    if (!cycle_id) cycle_id = popped;    popped->cycle_id = cycle_id;       /* This extra ref is taken away in the kill pass. Don't add one    * if it got an extra ref already due to weak free. */ -  if (!(m->flags & GC_GOT_DEAD_REF)) +  if (!(m->gc_flags & GC_GOT_DEAD_REF))    gc_add_extra_ref (popped->data);       CHECK_KILL_LIST_FRAME (popped);    CYCLE_DEBUG_MSG (popped, "> gc_cycle_pop, move to kill list");    }       else { -  if (!(m->flags & GC_LIVE)) { +  if (!(m->gc_flags & GC_LIVE)) {    /* Add an extra ref which is taken away in the free pass. This    * is done to not refcount garb the cycles themselves    * recursively, which in bad cases can consume a lot of C    * stack. */ -  if (!(m->flags & GC_GOT_DEAD_REF)) { +  if (!(m->gc_flags & GC_GOT_DEAD_REF)) {    gc_add_extra_ref (popped->data); -  m->flags |= GC_GOT_DEAD_REF; +  m->gc_flags |= GC_GOT_DEAD_REF;    }    }   #ifdef PIKE_DEBUG    else -  if (m->flags & GC_GOT_DEAD_REF) +  if (m->gc_flags & GC_GOT_DEAD_REF)    gc_fatal (popped->data, 0, "Didn't expect a dead extra ref.\n");   #endif       CYCLE_DEBUG_MSG (popped, "> gc_cycle_pop, free");    m->frame = NULL;    really_free_gc_rec_frame (popped);    }       popped = next;    } while (popped);
pike.git/src/gc.c:3256:      void do_gc_recurse_short_svalue(union anything *u, int type)   {    gc_recurse_short_svalue(u, type);   }      int gc_do_free(void *a)   {    struct marker *m;   #ifdef PIKE_DEBUG -  if (gc_is_watching && (m = find_marker(a)) && m->flags & GC_WATCHED) { +  if (gc_is_watching && (m = find_marker(a)) && m->gc_flags & GC_WATCHED) {    /* This is useful to set breakpoints on. */    gc_watched_found (m, "gc_do_free()");    }    if (!a) Pike_fatal("Got null pointer.\n");    if (Pike_in_gc != GC_PASS_FREE)    Pike_fatal("gc free attempted in invalid pass.\n");   #endif       m=find_marker(debug_malloc_pass(a));    if (!m) return 0; /* Object created after cycle pass. */       if (gc_destruct_everything) {    /* We don't actually free much in this mode, just destruct    * objects. So when we normally would return nonzero we just    * remove the extra ref again. */ -  if (!(m->flags & GC_LIVE)) { +  if (!(m->gc_flags & GC_LIVE)) {    if (*(INT32 *) a == 1)    return 1;    else {    gc_free_extra_ref (a);    sub_ref ((struct ref_dummy *) a);    }    }    return 0;    }      #ifdef PIKE_DEBUG -  if (*(INT32 *) a > !!(m->flags & GC_GOT_EXTRA_REF)) { +  if (*(INT32 *) a > !!(m->gc_flags & GC_GOT_EXTRA_REF)) {    if (!gc_destruct_everything && -  (!(m->flags & GC_NOT_REFERENCED) || m->flags & GC_MARKED)) +  (!(m->gc_flags & GC_NOT_REFERENCED) || m->gc_flags & GC_MARKED))    gc_fatal(a, 0, "gc_do_free() called for referenced thing.\n");    if (gc_debug && -  (m->flags & (GC_PRETOUCHED|GC_MARKED|GC_IS_REFERENCED)) == GC_PRETOUCHED) +  (m->gc_flags & (GC_PRETOUCHED|GC_MARKED|GC_IS_REFERENCED)) == GC_PRETOUCHED)    gc_fatal(a, 0, "gc_do_free() called without prior call to "    "gc_mark() or gc_is_referenced().\n");    }    if(!gc_destruct_everything && -  (m->flags & (GC_MARKED|GC_XREFERENCED)) == GC_XREFERENCED) +  (m->gc_flags & (GC_MARKED|GC_XREFERENCED)) == GC_XREFERENCED)    gc_fatal(a, 1, "Thing with external reference missed in gc mark pass.\n"); -  if ((m->flags & (GC_DO_FREE|GC_LIVE)) == GC_LIVE) live_ref++; -  m->flags |= GC_DO_FREE; +  if ((m->gc_flags & (GC_DO_FREE|GC_LIVE)) == GC_LIVE) live_ref++; +  m->gc_flags |= GC_DO_FREE;   #endif    -  return !(m->flags & GC_LIVE); +  return !(m->gc_flags & GC_LIVE);   }      #if 0   static void free_obj_arr(void *oa)   {    struct array *obj_arr = *((struct array **)oa);       if (obj_arr) free_array(obj_arr);    free(oa);   }
pike.git/src/gc.c:3667: Inside #if defined(PIKE_DEBUG)
   n += gc_touch_all_objects();   #ifdef PIKE_DEBUG    gc_touch_all_strings();   #endif    if (n != (unsigned) num_objects && !got_unlinked_things)    Pike_fatal("Object count wrong in gc; expected %d, got %d.\n", num_objects, n);   #if 0 /* Temporarily disabled - Hubbe */   #ifdef PIKE_DEBUG   #ifdef DEBUG_MALLOC    PTR_HASH_LOOP(marker, i, m) -  if (!(m->flags & (GC_POSTTOUCHED|GC_WEAK_FREED)) && +  if (!(m->gc_flags & (GC_POSTTOUCHED|GC_WEAK_FREED)) &&    dmalloc_is_invalid_memory_block(m->data)) {    fprintf(stderr, "Found a stray marker after posttouch pass: ");    describe_marker(m);    fprintf(stderr, "Describing marker location(s):\n");    debug_malloc_dump_references(m, 2, 1, 0);    fprintf(stderr, "Describing thing for marker:\n");    Pike_in_gc = 0;    describe(m->data);    Pike_in_gc = GC_PASS_POSTTOUCH;    Pike_fatal("Fatal in garbage collector.\n");
pike.git/src/gc.c:3800: Inside #if defined(PIKE_DEBUG)
   }    }    }   #endif       while (kill_list != &sentinel_frame) {    struct gc_rec_frame *next = kill_list->next;    struct object *o = (struct object *) kill_list->data;      #ifdef PIKE_DEBUG -  if ((get_marker(kill_list->data)->flags & (GC_LIVE|GC_LIVE_OBJ)) != +  if ((get_marker(kill_list->data)->gc_flags & (GC_LIVE|GC_LIVE_OBJ)) !=    (GC_LIVE|GC_LIVE_OBJ))    gc_fatal(o, 0, "Invalid object on kill list.\n");    if (o->prog && (o->prog->flags & PROGRAM_USES_PARENT) &&    PARENT_INFO(o)->parent &&    !PARENT_INFO(o)->parent->prog && -  get_marker(PARENT_INFO(o)->parent)->flags & GC_LIVE_OBJ) +  get_marker(PARENT_INFO(o)->parent)->gc_flags & GC_LIVE_OBJ)    gc_fatal(o, 0, "GC destructed parent prematurely.\n");   #endif       GC_VERBOSE_DO(    fprintf(stderr, "| Killing %p with %d refs", o, o->refs);    if (o->prog) {    INT_TYPE line;    struct pike_string *file = get_program_line (o->prog, &line);    fprintf(stderr, ", prog %s:%d\n", file->str, line);    free_string(file);