Branch: Tag:

2018-05-19

2018-05-19 12:39:54 by Arne Goedeke <el@laramies.com>

GC: rename refs to gc_refs in gc marker

This is preparation for moving the refcount into the same struct.

1003:    if (m) {    fprintf(stderr, "marker at %p: flags=0x%05lx refs=%d weak=%d "    "xrefs=%d saved=%d frame=%p", -  m, (long) m->flags, m->refs, m->weak_refs, +  m, (long) m->flags, m->gc_refs, m->weak_refs,    m->xrefs, m->saved_refs, m->frame);    if (m->frame) {    fputs(" [", stderr);
1933: Inside #if defined(PIKE_DEBUG)
   if (m->saved_refs == -1) m->saved_refs = *(INT32 *)a;    else if (m->saved_refs != *(INT32 *)a)    gc_fatal(a, 1, "Refs changed in gc check pass.\n"); -  if (m->refs + m->xrefs >= *(INT32 *) a) -  /* m->refs will be incremented by the caller. */ +  if (m->gc_refs + m->xrefs >= *(INT32 *) a) +  /* m->gc_refs will be incremented by the caller. */    gc_fatal (a, 1, "Thing is getting more internal refs (%d + %d) "    "than refs (%d).\n"    "(Could be an extra free somewhere, or "    "a pointer might have been checked more than once.)\n", -  m->refs, m->xrefs, *(INT32 *) a); +  m->gc_refs, m->xrefs, *(INT32 *) a);    checked++;       return m;
1964:    m = get_marker(a);   #endif    -  ret=m->refs; -  add_ref(m); -  if (m->refs == *(INT32 *) a) +  ret=m->gc_refs++; +  if (m->gc_refs == *(INT32 *) a)    m->flags |= GC_NOT_REFERENCED;    return ret;   }
1988: Inside #if defined(PIKE_DEBUG)
   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->refs + 1) +  if (m->weak_refs > m->gc_refs + 1)    gc_fatal(a, 1, "Thing has gotten more weak refs than internal refs.\n");   #else    m = get_marker(a);
1999:    if (m->weak_refs == *(INT32 *) a)    m->weak_refs = -1;    -  ret=m->refs; -  add_ref(m); -  if (m->refs == *(INT32 *) a) +  ret=m->gc_refs++; +  if (m->gc_refs == *(INT32 *) a)    m->flags |= GC_NOT_REFERENCED;    return ret;   }
2215: Inside #if defined(PIKE_DEBUG)
   m->xrefs++;    m->flags|=GC_XREFERENCED;    if(Pike_in_gc == GC_PASS_CHECK && -  (m->refs + m->xrefs > *(INT32 *)a || +  (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;
2401: Inside #if defined(PIKE_DEBUG)
   else m = get_marker(a);    debug_malloc_touch(a);    -  if (m->weak_refs > m->refs) +  if (m->weak_refs > m->gc_refs)    gc_fatal(a, 0, "More weak references than internal references.\n");   #else    m = get_marker(a);
2502:       m = get_marker (a);    -  /* Note: m->refs and m->xrefs are useless already here due to how +  /* Note: m->gc_refs and m->xrefs are useless already here due to how    * gc_free_(short_)svalue works. */      #ifdef PIKE_DEBUG