Changeset 9380


Ignore:
Timestamp:
May 6, 2008, 5:38:18 PM (11 years ago)
Author:
rme
Message:

Some feeble attempts at x8632 changes, including:

  • function word count is only 16 bits on x8632
  • tra handling

The link inverting marker (rmark) is not working.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ia32/lisp-kernel/x86-gc.c

    r8372 r9380  
    5050#endif
    5151
     52int
     53function_code_words(LispObj *f)
     54{
     55#ifdef X8664
     56  return (int)f[1];
     57#else
     58  return (unsigned short)f[1];
     59#endif
     60}
    5261
    5362void
     
    223232
    224233
    225 Boolean GCDebug = false, GCverbose = false;
     234Boolean GCDebug = true, GCverbose = true;
    226235
    227236
     
    249258      elements = header_element_count(node) | 1;
    250259      if (header_subtag(node) == subtag_function) {
     260#ifdef X8632
     261        int skip = *(unsigned short *)current;
     262#else
    251263        int skip = *(int *)current;
     264#endif
    252265        current += skip;
    253266        elements -= skip;
     
    355368#ifdef X8632
    356369  if (tag_n == fulltag_tra) {
    357     if (*((unsigned char *)n) == RECOVER_FN_OPCODE)
    358       n = (LispObj)(*((natural *)(n + 1)));
    359     else
     370    unsigned char *p = (unsigned char *)n;
     371
     372    if (*p == RECOVER_FN_OPCODE) {
     373      n = *(LispObj *)(p + 1);
     374      tag_n = fulltag_misc;
     375    } else
    360376      return;
    361377  }
     
    474490
    475491      if (subtag == subtag_function) {
     492#ifdef X8632
     493        prefix_nodes = (natural) ((unsigned short) deref(base,1));
     494#else
    476495        prefix_nodes = (natural) ((int) deref(base,1));
     496#endif
     497        prefix_nodes = (natural)function_code_words(base);
    477498        if (prefix_nodes > element_count) {
    478499          Bug(NULL, "Function 0x%lx trashed",n);
     
    529550#define RMARK_PREV_CAR fulltag_nil /* fulltag_nil + node_size. Coincidence ? I think not. */
    530551#else
     552#define RMARK_PREV_ROOT fulltag_imm
     553#define RMARK_PREV_CAR fulltag_immheader
    531554#endif
    532555
    533556natural
    534557GCstack_limit = 0;
    535 
    536 #ifdef X8632
    537 void rmark(LispObj n)
    538 {
    539 }
    540 #else
    541558
    542559/*
     
    558575#ifdef X8632
    559576  if (tag_n == fulltag_tra) {
    560     if (*((unsigned char *)n) == RECOVER_FN_OPCODE)
    561       n = (LispObj)(*((natural *)(n + 1)));
    562     else
     577    unsigned char *p = (unsigned char *)n;
     578
     579    if (*p == RECOVER_FN_OPCODE) {
     580      n = *(LispObj *)(p + 1);
     581      tag_n = fulltag_misc;
     582    } else
    563583      return;
    564584  }
     
    619639        }
    620640      }
    621 #endif
    622 #ifdef X8632
     641#else
    623642      if ((tag_n == fulltag_nodeheader) ||
    624643          (subtag <= max_32_bit_ivector_subtag)) {
     
    678697
    679698      if (subtag == subtag_function) {
    680         if ((int)base[1] >= nmark) {
     699#ifdef X8664
     700        int code_words = (int)base[1];
     701#else
     702        int code_words = (unsigned short)base[1];
     703#endif
     704        if (code_words >= nmark) {
    681705          Bug(NULL,"Bad function at 0x%lx",n);
    682706        }
    683         nmark -= (int)base[1];
     707        nmark -= code_words;
    684708      }
    685709
     
    696720    }
    697721  } else {
    698 
    699722    /* This is all a bit more complicated than the PPC version:
    700723
     
    783806    case tag_misc:
    784807    case fulltag_misc:
     808#ifdef X8664
    785809    case tag_symbol:
    786810    case fulltag_symbol:
    787811    case tag_function:
    788812    case fulltag_function:
     813#endif
    789814      goto ClimbVector;
    790815
     
    842867
    843868  MarkVector:
     869#ifdef X8664
    844870    if ((tag_n == fulltag_tra_0) ||
    845871        (tag_n == fulltag_tra_1)) {
     
    882908      }
    883909    }
     910#else
     911    if (tag_n == fulltag_tra) {
     912      unsigned char *p = (unsigned char *)n;
     913      LispObj fn = *(LispObj *)(p + 1);
     914
     915      base = (LispObj *)untag(fn);
     916      header = *(natural *)base;
     917      subtag = header_subtag(header);
     918      boundary = base + (unsigned short)base[1];
     919      /*
     920       * On x8632, the upper 24 bits of the boundary word are zero.
     921       * Functions on x8632 can be no more than 2^16 words (or 2^24
     922       * bytes) long (including the self-reference table but excluding
     923       * any constants).  Therefore, we can do the same basic thing
     924       * that the x8664 port does: namely, we keep the byte
     925       * displacement from the address of the object (tagged tra or
     926       * fulltag_misc) that references the function to the address of
     927       * the boundary marker in those 24 bits, recovering it when
     928       * we've finished marking the function vector.
     929       */
     930      ((int *)boundary)[1] &= 0xff;
     931      ((int *)boundary)[1] |= (this-(LispObj)boundary) << 8;
     932      this = (LispObj)(base)+fulltag_misc;
     933      dnode = gc_area_dnode(this);
     934      set_bit(markbits,dnode);
     935    } else {
     936      base = (LispObj *) ptr_from_lispobj(untag(this));
     937      header = *((natural *) base);
     938      subtag = header_subtag(header);
     939      if (subtag == subtag_function) {
     940        boundary = base + (unsigned short)base[1];
     941        ((int *)boundary)[1] &= 0xff;
     942        ((int *)boundary)[1] |= (this-((LispObj)boundary)) << 8;
     943      }
     944    }
     945    element_count = header_element_count(header);
     946    tag_n = fulltag_of(header);
     947
     948    if ((tag_n == fulltag_nodeheader) ||
     949        (subtag <= max_32_bit_ivector_subtag)) {
     950      total_size_in_bytes = 4 + (element_count<<2);
     951    } else if (subtag <= max_8_bit_ivector_subtag) {
     952      total_size_in_bytes = 4 + element_count;
     953    } else if (subtag <= max_16_bit_ivector_subtag) {
     954      total_size_in_bytes = 4 + (element_count<<1);
     955    } else if (subtag == subtag_double_float_vector) {
     956      total_size_in_bytes = 8 + (element_count<<3);
     957    } else {
     958      total_size_in_bytes = 4 + ((element_count+7)>>3);
     959    }
     960#endif
     961
    884962    suffix_dnodes = ((total_size_in_bytes+(dnode_size-1))>>dnode_shift)-1;
    885963   
     
    9261004    this -= node_size;
    9271005    next = indirect_node(this);
     1006#ifdef X8664
    9281007    if ((tag_of(this) == tag_function) &&
    9291008        (header_subtag(next) == function_boundary_marker)) goto MarkFunctionDone;
     1009#else
     1010    if ((tag_of(this) == tag_misc) &&
     1011        (header_subtag(this) == subtag_function) &&
     1012        (header_subtag(next) == function_boundary_marker)) goto MarkFunctionDone;
     1013#endif
     1014
    9301015    tag_n = fulltag_of(next);
    9311016    if (nodeheader_tag_p(tag_n)) goto MarkVectorDone;
     
    9531038  MarkFunctionDone:
    9541039    boundary = (LispObj *)(node_aligned(this));
     1040#ifdef X8664
    9551041    this = ((LispObj)boundary) + (((int *)boundary)[1]);
    9561042    (((int *)boundary)[1]) = 0;
     1043#else
     1044    this = ((LispObj)boundary) + ((int *)boundary)[1] >> 8;
     1045    ((int *)boundary)[1] &= 0xff;
    9571046    goto Climb;
    958   }
    959 }
    960 #endif
     1047#endif
     1048  }
     1049}
    9611050
    9621051LispObj *
     
    11981287        base = start + element_count + 1;
    11991288        if (subtag == subtag_function) {
     1289#ifdef X8632
     1290          element_count -= (unsigned short)start[1];
     1291#else
    12001292          element_count -= (int)start[1];
     1293#endif
    12011294        }
    12021295        while(element_count--) {
     
    17201813#endif
    17211814  }
     1815
     1816#ifdef X8632
     1817  mark_root(tcr->save0);
     1818  mark_root(tcr->save1);
     1819  mark_root(tcr->save2);
     1820  mark_root(tcr->save3);
     1821  mark_root(tcr->next_method_context);
     1822#endif
    17221823}
    17231824     
     
    21022203      } else {
    21032204        if (header_subtag(node) == subtag_function) {
     2205#ifdef X8632
     2206          int skip = (unsigned short)(p[1]);
     2207#else
    21042208          int skip = (int)(p[1]);
     2209#endif
    21052210          p += skip;
    21062211          nwords -= skip;
     
    24012506          dnode += node_dnodes;
    24022507          if (header_subtag(node) == subtag_function) {
     2508#ifdef X8632
     2509            int skip = *((unsigned short *)src);
     2510#else
    24032511            int skip = *((int *)src);
     2512#endif
    24042513            *dest++ = node;
    24052514            elements -= skip;
     
    31843293purify_range(LispObj *start, LispObj *end, BytePtr low, BytePtr high, area *to, int what)
    31853294{
    3186 #ifdef X8664
    31873295  LispObj header;
    31883296  unsigned tag;
     
    32303338        } else {
    32313339          if (header_subtag(header) == subtag_function) {
     3340#ifdef X8632
     3341            int skip = (int)((unsigned short*)start[2]);
     3342#else
    32323343            int skip = (int)(start[1]);
     3344#endif
    32333345            start += skip;
    32343346            nwords -= skip;
     
    32493361    }
    32503362  }
    3251 #endif
    32523363}
    32533364       
Note: See TracChangeset for help on using the changeset viewer.