Changeset 15783


Ignore:
Timestamp:
Mar 24, 2013, 4:28:27 AM (6 years ago)
Author:
gb
Message:

GC integrity check processes readonly area. (Should only contain ivectors
and functions; function constants should be in some static area.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/x86-gc.c

    r15504 r15783  
    195195
    196196
    197 
     197void
     198check_readonly_range(LispObj *start, LispObj *end)
     199{
     200  LispObj node, *current = start, *prev = NULL, *next, fn;
     201  int tag, subtag;
     202  natural elements;
     203  area *a;
     204  area_code code;
     205
     206  while (current < end) {
     207    prev = current;
     208    node = *current++;
     209    tag = fulltag_of(node);
     210    if (immheader_tag_p(tag)) {
     211      current = (LispObj *)skip_over_ivector((natural)prev, node);
     212    } else {
     213      if (nodeheader_tag_p(tag)) {
     214        next = current+(header_element_count(node)|1);
     215      } else {
     216        next = current+1;
     217      }
     218      subtag = header_subtag(node);
     219      if (subtag != subtag_function) {
     220        Bug(NULL, "Found 0x" LISP " in readonly area at 0x" LISP ", expected ivector or function header", node, (LispObj)current);
     221      } else {
     222        elements = header_element_count(node);
     223        {
     224#ifdef X8632
     225          int skip = *(unsigned short *)current;
     226         
     227          fn = (LispObj)(current-1)+fulltag_misc;
     228          /* XXX bootstrapping */
     229          if (skip & 0x8000)
     230            skip = elements - (skip & 0x7fff);
     231#else
     232          int skip = *(int *)current;
     233          fn = (LispObj)(current-1)+fulltag_function;
     234#endif
     235          current += skip;
     236          elements -= skip;
     237        }
     238        while (elements--) {
     239          node = *current;
     240          if (is_node_fulltag(fulltag_of(node))) {
     241            a = area_containing((BytePtr)node);
     242            if (a) {
     243              code = a->code;
     244            } else {
     245              a = AREA_VOID;
     246            }
     247            switch (code) {
     248            case AREA_READONLY:
     249            case AREA_MANAGED_STATIC:
     250            case AREA_STATIC:
     251              break;
     252            default:
     253              Bug(NULL, "Bad constant reference from purified function 0x" LISP " to 0x" LISP ".", fn, node);
     254            }
     255          }
     256          current++;
     257        }
     258      }
     259      current = next;
     260    }
     261  }
     262  if (current != end) {
     263    Bug(NULL, "Overran end of memory range: start = 0x" LISP ", end = 0x" LISP ", prev = 0x" LISP ", current = 0x" LISP "",
     264        start, end, prev, current);
     265  }
     266}
    198267
    199268
     
    345414      check_range((LispObj *)a->low, (LispObj *)a->active, true);
    346415      break;
     416
     417    case AREA_READONLY:
     418      check_readonly_range((LispObj *)a->low, (LispObj *)a->active);
     419      true;
    347420
    348421    case AREA_VSTACK:
Note: See TracChangeset for help on using the changeset viewer.