Ignore:
Timestamp:
Feb 22, 2004, 1:27:13 AM (16 years ago)
Author:
gb
Message:

PPC64 changes (some of them rather suspect ...). 32-bit kernel may be a
little funky ...

File:
1 edited

Legend:

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

    r54 r557  
    4747  area *a = (area *) (zalloc(sizeof(area)));
    4848  if (a) {
    49     unsigned ndwords = area_dword(highaddr, lowaddr);
     49    unsigned ndnodes = area_dnode(highaddr, lowaddr);
    5050    a->low = lowaddr;
    5151    a->high = highaddr;
    5252    a->active = (code == AREA_DYNAMIC) ? lowaddr : highaddr;
    5353    a->code = code;
    54     a->ndwords = ndwords;
     54    a->ndnodes = ndnodes;
    5555    /* Caller must allocate markbits when allocating heap ! */
    5656   
     
    183183  case fulltag_even_fixnum:
    184184  case fulltag_odd_fixnum:
     185#ifdef PPC64
     186  case fulltag_imm_0:
     187  case fulltag_imm_1:
     188  case fulltag_imm_2:
     189  case fulltag_imm_3:
     190#else
    185191  case fulltag_imm:
     192#endif
    186193    return;
    187194
     195#ifndef PPC64
    188196  case fulltag_nil:
    189197    if (n != lisp_nil) {
     
    191199    }
    192200    return;
    193 
     201#endif
     202
     203#ifdef PPC64
     204  case fulltag_nodeheader_0:
     205  case fulltag_nodeheader_1:
     206  case fulltag_nodeheader_2:
     207  case fulltag_nodeheader_3:
     208  case fulltag_immheader_0:
     209  case fulltag_immheader_1:
     210  case fulltag_immheader_2:
     211  case fulltag_immheader_3:
     212#else
    194213  case fulltag_nodeheader:
    195214  case fulltag_immheader:
     215#endif
    196216    Bug(NULL, "Header not expected : 0x%08x", n);
    197217    return;
     
    199219  case fulltag_misc:
    200220  case fulltag_cons:
    201     a = heap_area_containing((BytePtr)n);
     221    a = heap_area_containing((BytePtr)ptr_from_lispobj(n));
    202222   
    203223    if (a == NULL) {
     
    207227         bad .. */
    208228      a = active_dynamic_area;
    209       if ((n > ((LispObj)a->active)) &&
    210           (n < ((LispObj)a->high))) {
     229      if ((n > (ptr_to_lispobj(a->active))) &&
     230          (n < (ptr_to_lispobj(a->high)))) {
    211231        Bug(NULL, "Node points to heap free space: 0x%08x", n);
    212232      }
     
    219239  header_tag = fulltag_of(header);
    220240  if (tag == fulltag_cons) {
    221     if ((header_tag == fulltag_nodeheader) ||
    222         (header_tag == fulltag_immheader)) {
     241    if ((nodeheader_tag_p(header_tag)) ||
     242        (immheader_tag_p(header_tag))) {
    223243      Bug(NULL, "Cons cell at 0x%08x has bogus header : 0x%08x", n, header);
    224244    }
     
    226246  }
    227247
    228   if ((header_tag != fulltag_nodeheader) &&
    229       (header_tag != fulltag_immheader)) {
     248  if ((!nodeheader_tag_p(header_tag)) &&
     249      (!immheader_tag_p(header_tag))) {
    230250    Bug(NULL,"Vector at 0x%08x has bogus header : 0x%08x", n, header);
    231251  }
     
    244264    node = *current++;
    245265    tag = fulltag_of(node);
    246     if (tag == fulltag_immheader) {
     266    if (immheader_tag_p(tag)) {
    247267      current = (LispObj *)skip_over_ivector((unsigned)prev, node);
    248     } else if (tag == fulltag_nodeheader) {
     268    } else if (nodeheader_tag_p(tag)) {
    249269      elements = header_element_count(node) | 1;
    250270      while (elements--) {
     
    299319             end != limit;
    300320             current = next) {
    301           next = (LispObj *) *current;
     321          next = ptr_from_lispobj(*current);
    302322          end = ((next >= start) && (next < limit)) ? next : limit;
    303323          if (current[1] == 0) {
     
    332352    }
    333353   
    334     if (tag == fulltag_immheader) {
    335       q = (LispObj *)skip_over_ivector((LispObj)p, header);
     354    if (immheader_tag_p(tag)) {
     355      q = (LispObj *)skip_over_ivector(ptr_to_lispobj(p), header);
    336356      if (q >= nextpage) {
    337357        bucket->halfword = 0;
    338358        return q;
    339359      }
    340     } else if (tag == fulltag_nodeheader) {
     360    } else if (nodeheader_tag_p(tag)) {
    341361      q = p + ((2 + header_element_count(header)) & ~1);
    342362      if (p >= page) {
     
    376396  LispObj *p, *page = (LispObj *)truncate_to_power_of_2(start,12);
    377397  pageentry
    378     *buckets = pagemap + (((LispObj)page - lisp_global(HEAP_START)) >> 12);
     398    *buckets = pagemap + (((ptr_to_lispobj(page)) - lisp_global(HEAP_START)) >> 12);
    379399
    380400  if (start != page) {
     
    398418                        LispObj *end,
    399419                        LispObj ephemeral_start,
    400                         unsigned long ephemeral_dwords)
     420                        unsigned long ephemeral_dnodes)
    401421{
    402422  LispObj node, oldspacestart = lisp_global(HEAP_START);
     
    407427    node = *start;
    408428    tag = fulltag_of(node);
    409     if (tag == fulltag_immheader) {     /* An ivector */
    410       start = (LispObj *)skip_over_ivector((LispObj)start, node);
     429    if (immheader_tag_p(tag)) { /* An ivector */
     430      start = ptr_from_lispobj(skip_over_ivector(ptr_to_lispobj(start), node));
    411431    } else {
    412432      if ((header_subtag(node) == subtag_hash_vector) ||
     
    414434             least if we have to track key movement */
    415435          (((tag == fulltag_cons) || (tag == fulltag_misc)) &&
    416            (area_dword(node, ephemeral_start) < ephemeral_dwords))) {
     436           (area_dnode(node, ephemeral_start) < ephemeral_dnodes))) {
    417437        /* Tagged pointer to (some) younger generation; update refmap */
    418         set_bit(refbits,area_dword(start, oldspacestart));
     438        set_bit(refbits,area_dnode(start, oldspacestart));
    419439      } else {
    420440        node = start[1];
    421441        tag = fulltag_of(node);
    422442        if (((tag == fulltag_cons) || (tag == fulltag_misc)) &&
    423             (area_dword(node, ephemeral_start) < ephemeral_dwords)) {
    424           set_bit(refbits,area_dword(start, oldspacestart));
     443            (area_dnode(node, ephemeral_start) < ephemeral_dnodes)) {
     444          set_bit(refbits,area_dnode(start, oldspacestart));
    425445        }
    426446      }
     
    434454                       LispObj *page,
    435455                       LispObj ephemeral_start,
    436                        unsigned ephemeral_dwords)
     456                       unsigned ephemeral_dnodes)
    437457{
    438458  LispObj *start;
     
    441461      start = page + bucket->bits.offset;
    442462      update_refmap_for_range(start,
    443                               (LispObj *) align_to_power_of_2((LispObj)start+1,12),
     463                              (LispObj *) align_to_power_of_2(ptr_to_lispobj(start+1),12),
    444464                              ephemeral_start,
    445                               ephemeral_dwords);
     465                              ephemeral_dnodes);
    446466    }
    447467  }
     
    452472update_refmap_for_area(area *a, BytePtr curfree)
    453473{
    454   if (a->ndwords) {
     474  if (a->ndnodes) {
    455475    LispObj
    456476      *start = (LispObj *) a->low,
     
    458478      *last_whole_page_end = (LispObj *) truncate_to_power_of_2(limit,12),
    459479      *first_partial_page_start = (LispObj *) truncate_to_power_of_2(start,12);
    460     pageentry *p = pagemap + ((LispObj)start - lisp_global(HEAP_START) >> 12);
    461     unsigned younger_dwords = area_dword((LispObj)curfree,(LispObj)limit);
     480    pageentry *p = pagemap + (ptr_to_lispobj(start) - lisp_global(HEAP_START) >> 12);
     481    unsigned younger_dnodes = area_dnode(ptr_to_lispobj(curfree),ptr_to_lispobj(limit));
    462482   
    463483    if (last_whole_page_end == first_partial_page_start) {
    464484      if (p->bits.modified && p->bits.hasnode) {
    465         update_refmap_for_range(start,limit,(LispObj)limit,younger_dwords);
     485        update_refmap_for_range(start,limit,ptr_to_lispobj(limit),younger_dnodes);
    466486      }
    467487    } else {
     
    470490          *page_end = first_partial_page_start + (4096 / sizeof(LispObj *));
    471491        if (p->bits.modified && p->bits.hasnode) {
    472           update_refmap_for_range(start,page_end,(LispObj)limit,younger_dwords);
     492          update_refmap_for_range(start,page_end,ptr_to_lispobj(limit),younger_dnodes);
    473493        }
    474494        start = page_end;
     
    478498           start < last_whole_page_end;
    479499           start += (4096 / sizeof(LispObj *)), p++) {
    480         update_refmap_for_page(p,start,(LispObj)limit,younger_dwords);
     500        update_refmap_for_page(p,start,ptr_to_lispobj(limit),younger_dnodes);
    481501      }
    482502      if (start < limit) {
    483503        if (p->bits.modified && p->bits.hasnode) {
    484           update_refmap_for_range(start+p->bits.offset,limit,(LispObj)limit,younger_dwords);
     504          update_refmap_for_range(start+p->bits.offset,limit,ptr_to_lispobj(limit),younger_dnodes);
    485505        }
    486506      }
     
    523543    tenured_low = tenured_area->low;
    524544  unsigned
    525     dynamic_dwords = area_dword(curfree, a->low),
    526     new_tenured_dwords = area_dword(curfree, tenured_area->low);
     545    dynamic_dnodes = area_dnode(curfree, a->low),
     546    new_tenured_dnodes = area_dnode(curfree, tenured_area->low);
    527547  bitvector
    528548    refbits = tenured_area->refbits,
     
    531551
    532552  target->high = target->active = curfree;
    533   target->ndwords = area_dword(curfree, target_low);
     553  target->ndnodes = area_dnode(curfree, target_low);
    534554
    535555  for (child = target->younger; child != a; child = child->younger) {
    536556    child->high = child->low = child->active = curfree;
    537     child->ndwords = 0;
     557    child->ndnodes = 0;
    538558  }
    539559
    540560  a->low = curfree;
    541   a->ndwords = area_dword(a->high, curfree);
    542 
    543   new_markbits = refbits + ((new_tenured_dwords + 31) >> 5);
     561  a->ndnodes = area_dnode(a->high, curfree);
     562
     563  new_markbits = refbits + ((new_tenured_dnodes + 31) >> 5);
    544564 
    545565  if (target == tenured_area) {
    546     zero_bits(refbits, new_tenured_dwords);
    547     lisp_global(OLDEST_EPHEMERAL) = (LispObj) curfree;
     566    zero_bits(refbits, new_tenured_dnodes);
     567    lisp_global(OLDEST_EPHEMERAL) = ptr_to_lispobj(curfree);
    548568  } else {
    549569    /* Need more (zeroed) refbits & fewer markbits */
     
    572592    area *a = active_dynamic_area, *child;
    573593    BytePtr curlow = from->low;
    574     unsigned new_tenured_dwords = area_dword(curlow, tenured_area->low);
     594    unsigned new_tenured_dnodes = area_dnode(curlow, tenured_area->low);
    575595   
    576596    for (child = from; child != a; child = child->younger) {
    577597      child->low = child->active = child->high = curlow;
    578       child->ndwords = 0;
     598      child->ndnodes = 0;
    579599    }
    580600   
    581601    a->low = curlow;
    582     a->ndwords = area_dword(a->high, curlow);
     602    a->ndnodes = area_dnode(a->high, curlow);
    583603   
    584     a->markbits = (tenured_area->refbits) + ((new_tenured_dwords+31)>>5);
     604    a->markbits = (tenured_area->refbits) + ((new_tenured_dnodes+31)>>5);
    585605    if (from == tenured_area) {
    586606      /* Everything's in the dynamic area */
     
    602622    }
    603623    if (activate) {
    604       LispObj *heap_start = (LispObj *)lisp_global(HEAP_START);
     624      LispObj *heap_start = ptr_from_lispobj(lisp_global(HEAP_START));
    605625
    606626      a->older = g1_area;
     
    709729bitvector GCmarkbits = NULL;
    710730LispObj GCarealow;
    711 unsigned GCndwords_in_area;
     731unsigned GCndnodes_in_area;
    712732LispObj GCweakvll = (LispObj)NULL;
    713733LispObj GCephemeral_low;
    714 unsigned GCn_ephemeral_dwords;
     734unsigned GCn_ephemeral_dnodes;
    715735
    716736
     
    722742{
    723743  int tag_n = fulltag_of(n);
    724   unsigned dword, bits, *bitsp, mask;
     744  unsigned dnode, bits, *bitsp, mask;
    725745
    726746  if (!is_node_fulltag(tag_n)) {
     
    728748  }
    729749
    730   dword = gc_area_dword(n);
    731   if (dword >= GCndwords_in_area) {
     750  dnode = gc_area_dnode(n);
     751  if (dnode >= GCndnodes_in_area) {
    732752    return;
    733753  }
    734   set_bits_vars(GCmarkbits,dword,bitsp,bits,mask);
     754  set_bits_vars(GCmarkbits,dnode,bitsp,bits,mask);
    735755  if (bits & mask) {
    736756    return;
     
    739759
    740760  if (tag_n == fulltag_cons) {
    741     cons *c = (cons *) untag(n);
     761    cons *c = (cons *) ptr_from_lispobj(untag(n));
    742762    rmark(c->car);
    743763    rmark(c->cdr);
     
    745765  }
    746766  {
    747     LispObj *base = (LispObj *) untag(n);
    748     unsigned
    749       header = *((unsigned *) base),
     767    LispObj *base = (LispObj *) ptr_from_lispobj(untag(n));
     768    natural
     769      header = *((natural *) base),
    750770      subtag = header_subtag(header),
    751771      element_count = header_element_count(header),
    752772      total_size_in_bytes,      /* including 4-byte header */
    753       suffix_dwords;
     773      suffix_dnodes;
    754774
    755775    tag_n = fulltag_of(header);
    756776
     777#ifdef PPC64
     778    if ((nodeheader_tag_p(tag_n)) ||
     779        (tag_n == ivector_class_64_bit)) {
     780      total_size_in_bytes = 8 + (element_count<<3);
     781    } else if (tag_n == ivector_class_8_bit) {
     782      total_size_in_bytes = 8 + element_count;
     783    } else if (tag_n == ivector_class_32_bit) {
     784      total_size_in_bytes = 8 + (element_count<<2);
     785    } else {
     786      /* ivector_class_other_bit contains 16-bit arrays & bitvector */
     787      if (subtag == subtag_bit_vector) {
     788        total_size_in_bytes = 8 + ((element_count+7)>>3);
     789      } else {
     790        total_size_in_bytes = 8 + (element_count<<1);
     791      }
     792    }
     793#else
    757794    if ((tag_n == fulltag_nodeheader) ||
    758795        (subtag <= max_32_bit_ivector_subtag)) {
     
    767804      total_size_in_bytes = 4 + ((element_count+7)>>3);
    768805    }
    769     suffix_dwords = ((total_size_in_bytes+7)>>3) -1;
    770 
    771     if (suffix_dwords) {
    772       set_n_bits(GCmarkbits, dword+1, suffix_dwords);
    773     }
    774 
    775     if (tag_n == fulltag_nodeheader) {
     806#endif
     807    suffix_dnodes = ((total_size_in_bytes+(dnode_size-1))>>dnode_shift) -1;
     808
     809    if (suffix_dnodes) {
     810      set_n_bits(GCmarkbits, dnode+1, suffix_dnodes);
     811    }
     812
     813    if (nodeheader_tag_p(tag_n)) {
    776814      if (subtag == subtag_hash_vector) {
    777815        ((hash_table_vector_header *) base)->cache_key = undefined;
     
    820858{
    821859  int tag_n = fulltag_of(n);
    822   unsigned eph_dword;
    823 
    824   if (tag_n == fulltag_nodeheader) {
     860  unsigned eph_dnode;
     861
     862  if (nodeheader_tag_p(tag_n)) {
    825863    return (header_subtag(n) == subtag_hash_vector);
    826864  }
     
    828866  if ((tag_n == fulltag_cons) ||
    829867      (tag_n == fulltag_misc)) {
    830     eph_dword = area_dword(n, GCephemeral_low);
    831     if (eph_dword < GCn_ephemeral_dwords) {
     868    eph_dnode = area_dnode(n, GCephemeral_low);
     869    if (eph_dnode < GCn_ephemeral_dnodes) {
    832870      mark_root(n);             /* May or may not mark it */
    833871      return true;              /* but return true 'cause it's an ephemeral node */
     
    855893    mark_root(pc);
    856894  } else {
    857     unsigned dword = gc_area_dword(pc);
    858     if ((dword < GCndwords_in_area) &&
    859         !ref_bit(GCmarkbits,dword)) {
     895    natural dnode = gc_area_dnode(pc);
     896    if ((dnode < GCndnodes_in_area) &&
     897        !ref_bit(GCmarkbits,dnode)) {
    860898      LispObj
    861899        *headerP,
    862900        header;
    863901
    864       for(headerP = (LispObj*)(untag(pc));
    865           dword < GCndwords_in_area;
    866           headerP-=2, --dword) {
     902      for(headerP = (LispObj*)ptr_from_lispobj(untag(pc));
     903          dnode < GCndnodes_in_area;
     904          headerP-=2, --dnode) {
    867905        header = *headerP;
    868906
    869907        if ((header & code_header_mask) == subtag_code_vector) {
    870           set_n_bits(GCmarkbits, dword, (2+header_element_count(header))>>1);
     908          set_n_bits(GCmarkbits, dnode, (2+header_element_count(header))>>1);
    871909          return;
    872910        }
     
    892930  int tag_n = fulltag_of(n);
    893931  bitvector markbits = GCmarkbits;
    894   unsigned dword, bits, *bitsp, mask;
     932  unsigned dnode, bits, *bitsp, mask;
    895933
    896934  if (!is_node_fulltag(tag_n)) {
     
    898936  }
    899937
    900   dword = gc_area_dword(n);
    901   if (dword >= GCndwords_in_area) {
     938  dnode = gc_area_dnode(n);
     939  if (dnode >= GCndnodes_in_area) {
    902940    return;
    903941  }
    904   set_bits_vars(markbits,dword,bitsp,bits,mask);
     942  set_bits_vars(markbits,dnode,bitsp,bits,mask);
    905943  if (bits & mask) {
    906944    return;
     
    958996    tag_n = fulltag_of(next);
    959997    if (!is_node_fulltag(tag_n)) goto MarkCdr;
    960     dword = gc_area_dword(next);
    961     if (dword >= GCndwords_in_area) goto MarkCdr;
    962     set_bits_vars(markbits,dword,bitsp,bits,mask);
     998    dnode = gc_area_dnode(next);
     999    if (dnode >= GCndnodes_in_area) goto MarkCdr;
     1000    set_bits_vars(markbits,dnode,bitsp,bits,mask);
    9631001    if (bits & mask) goto MarkCdr;
    9641002    *bitsp = (bits | mask);
     
    9761014    tag_n = fulltag_of(next);
    9771015    if (!is_node_fulltag(tag_n)) goto Climb;
    978     dword = gc_area_dword(next);
    979     if (dword >= GCndwords_in_area) goto Climb;
    980     set_bits_vars(markbits,dword,bitsp,bits,mask);
     1016    dnode = gc_area_dnode(next);
     1017    if (dnode >= GCndnodes_in_area) goto Climb;
     1018    set_bits_vars(markbits,dnode,bitsp,bits,mask);
    9811019    if (bits & mask) goto Climb;
    9821020    *bitsp = (bits | mask);
     
    9911029  MarkVector:
    9921030    {
    993       LispObj *base = (LispObj *) untag(this);
    994       unsigned
    995         header = *((unsigned *) base),
    996       subtag = header_subtag(header),
    997       element_count = header_element_count(header),
    998       total_size_in_bytes,
    999       suffix_dwords;
     1031      LispObj *base = (LispObj *) ptr_from_lispobj(untag(this));
     1032      natural
     1033        header = *((natural *) base),
     1034        subtag = header_subtag(header),
     1035        element_count = header_element_count(header),
     1036        total_size_in_bytes,
     1037        suffix_dnodes;
    10001038
    10011039      tag_n = fulltag_of(header);
    10021040
     1041#ifdef PPC64
     1042    if ((nodeheader_tag_p(tag_n)) ||
     1043        (tag_n == ivector_class_64_bit)) {
     1044      total_size_in_bytes = 8 + (element_count<<3);
     1045    } else if (tag_n == ivector_class_8_bit) {
     1046      total_size_in_bytes = 8 + element_count;
     1047    } else if (tag_n == ivector_class_32_bit) {
     1048      total_size_in_bytes = 8 + (element_count<<2);
     1049    } else {
     1050      /* ivector_class_other_bit contains 16-bit arrays & bitvector */
     1051      if (subtag == subtag_bit_vector) {
     1052        total_size_in_bytes = 8 + ((element_count+7)>>3);
     1053      } else {
     1054        total_size_in_bytes = 8 + (element_count<<1);
     1055      }
     1056    }
     1057#else
    10031058      if ((tag_n == fulltag_nodeheader) ||
    10041059          (subtag <= max_32_bit_ivector_subtag)) {
     
    10131068        total_size_in_bytes = 4 + ((element_count+7)>>3);
    10141069      }
    1015       suffix_dwords = ((total_size_in_bytes+7)>>3)-1;
    1016 
    1017       if (suffix_dwords) {
    1018         set_n_bits(GCmarkbits, dword+1, suffix_dwords);
    1019       }
    1020 
    1021       if (tag_n != fulltag_nodeheader) goto Climb;
     1070#endif
     1071      suffix_dnodes = ((total_size_in_bytes+(dnode_size-1))>>dnode_shift)-1;
     1072
     1073      if (suffix_dnodes) {
     1074        set_n_bits(GCmarkbits, dnode+1, suffix_dnodes);
     1075      }
     1076
     1077      if (!nodeheader_tag_p(tag_n)) goto Climb;
    10221078
    10231079      if (subtag == subtag_hash_vector) {
     
    10421098      }
    10431099
    1044       this = untag(this) + ((element_count+1) << 2);
     1100      this = untag(this) + ((element_count+1) << node_shift);
    10451101      goto MarkVectorLoop;
    10461102    }
    10471103
    10481104  ClimbVector:
    1049     prev = *((LispObj *) this);
    1050     *((LispObj *) this) = next;
     1105    prev = *((LispObj *) ptr_from_lispobj(this));
     1106    *((LispObj *) ptr_from_lispobj(this)) = next;
    10511107
    10521108  MarkVectorLoop:
    1053     this -= 4;
    1054     next = *((LispObj *) this);
     1109    this -= node_size;
     1110    next = *((LispObj *) ptr_from_lispobj(this));
    10551111    tag_n = fulltag_of(next);
    1056     if (tag_n == fulltag_nodeheader) goto MarkVectorDone;
     1112    if (nodeheader_tag_p(tag_n)) goto MarkVectorDone;
    10571113    if (!is_node_fulltag(tag_n)) goto MarkVectorLoop;
    1058     dword = gc_area_dword(next);
    1059     if (dword >= GCndwords_in_area) goto MarkVectorLoop;
    1060     set_bits_vars(markbits,dword,bitsp,bits,mask);
     1114    dnode = gc_area_dnode(next);
     1115    if (dnode >= GCndnodes_in_area) goto MarkVectorLoop;
     1116    set_bits_vars(markbits,dnode,bitsp,bits,mask);
    10611117    if (bits & mask) goto MarkVectorLoop;
    10621118    *bitsp = (bits | mask);
    1063     *((LispObj *) this) = prev;
     1119    *(ptr_from_lispobj(this)) = prev;
    10641120    if (tag_n == fulltag_cons) goto DescendCons;
    10651121    goto DescendVector;
     
    10781134}
    10791135
    1080 unsigned
    1081 skip_over_ivector(unsigned start, LispObj header)
    1082 {
    1083   unsigned
     1136LispObj *
     1137skip_over_ivector(natural start, LispObj header)
     1138{
     1139  natural
    10841140    element_count = header_element_count(header),
    10851141    subtag = header_subtag(header),
    10861142    nbytes;
    10871143
     1144#ifdef PPC64
     1145  switch (fulltag_of(header)) {
     1146  case ivector_class_64_bit:
     1147    nbytes = element_count << 3;
     1148    break;
     1149  case ivector_class_32_bit:
     1150    nbytes = element_count << 2;
     1151    break;
     1152  case ivector_class_8_bit:
     1153    nbytes = element_count;
     1154    break;
     1155  case ivector_class_other_bit:
     1156  default:
     1157    if (subtag == subtag_bit_vector) {
     1158      nbytes = (element_count+7)>>3;
     1159    } else {
     1160      nbytes = element_count << 1;
     1161    }
     1162  }
     1163  return ptr_from_lispobj(start+(~15 & (nbytes + 8 + 15)));
     1164#else
    10881165  if (subtag <= max_32_bit_ivector_subtag) {
    10891166    nbytes = element_count << 2;
     
    10971174    nbytes = (element_count+7) >> 3;
    10981175  }
    1099   return start+(~7 & (nbytes + 4 + 7));
     1176  return ptr_from_lispobj(start+(~7 & (nbytes + 4 + 7)));
     1177#endif
    11001178}
    11011179
     
    11061184  LispObj x1, *base = start;
    11071185  int tag;
    1108   unsigned ref_dword, node_dword;
     1186  natural ref_dnode, node_dnode;
    11091187  Boolean intergen_ref;
    11101188
    11111189  while (start < end) {
    11121190    x1 = *start;
    1113     if ((tag = fulltag_of(x1)) == fulltag_immheader) {
    1114       start = (LispObj *)skip_over_ivector((unsigned) start, x1);
     1191    tag = fulltag_of(x1);
     1192    if (immheader_tag_p(tag)) {
     1193      start = skip_over_ivector(ptr_to_lispobj(start), x1);
    11151194    } else {
    11161195      intergen_ref = false;
    11171196      if ((tag == fulltag_misc) || (tag == fulltag_cons)) {       
    1118         node_dword = gc_area_dword(x1);
    1119         if (node_dword < GCndwords_in_area) {
     1197        node_dnode = gc_area_dnode(x1);
     1198        if (node_dnode < GCndnodes_in_area) {
    11201199          intergen_ref = true;
    11211200        }
     
    11251204        tag = fulltag_of(x1);
    11261205        if ((tag == fulltag_misc) || (tag == fulltag_cons)) {
    1127           node_dword = gc_area_dword(x1);
    1128           if (node_dword < GCndwords_in_area) {
     1206          node_dnode = gc_area_dnode(x1);
     1207          if (node_dnode < GCndnodes_in_area) {
    11291208            intergen_ref = true;
    11301209          }
     
    11321211      }
    11331212      if (intergen_ref) {
    1134         ref_dword = area_dword(start, base);
    1135         if (!ref_bit(refbits, ref_dword)) {
     1213        ref_dnode = area_dnode(start, base);
     1214        if (!ref_bit(refbits, ref_dnode)) {
    11361215          Bug(NULL, "Missing memoization in doubleword at 0x%08X", start);
    1137           set_bit(refbits, ref_dword);
     1216          set_bit(refbits, ref_dnode);
    11381217        }
    11391218      }
     
    11461225
    11471226void
    1148 mark_memoized_area(area *a, unsigned num_memo_dwords)
     1227mark_memoized_area(area *a, unsigned num_memo_dnodes)
    11491228{
    11501229  bitvector refbits = a->refbits;
    11511230  LispObj *p = (LispObj *) a->low, x1, x2;
    1152   unsigned inbits, outbits, bits, bitidx, *bitsp, nextbit, diff, memo_dword = 0;
     1231  unsigned inbits, outbits, bits, bitidx, *bitsp, nextbit, diff, memo_dnode = 0;
    11531232  Boolean keep_x1, keep_x2;
    11541233
    11551234  if (GCDebug) {
    1156     check_refmap_consistency(p, p+(num_memo_dwords << 1), refbits);
     1235    check_refmap_consistency(p, p+(num_memo_dnodes << 1), refbits);
    11571236  }
    11581237
     
    11701249
    11711250  /*
    1172     We need to ensure that there are no bits set at or beyond "num_memo_dwords"
     1251    We need to ensure that there are no bits set at or beyond "num_memo_dnodes"
    11731252    in the bitvector.  (This can happen as the EGC tenures/untenures things.)
    11741253    We find bits by grabbing a fullword at a time and doing a cntlzw instruction;
    1175     and don't want to have to check for (< memo_dword num_memo_dwords) in the loop.
     1254    and don't want to have to check for (< memo_dnode num_memo_dnodes) in the loop.
    11761255    */
    11771256
    11781257  {
    11791258    unsigned
    1180       bits_in_last_word = (num_memo_dwords & 0x1f),
    1181       index_of_last_word = (num_memo_dwords >> 5);
     1259      bits_in_last_word = (num_memo_dnodes & 0x1f),
     1260      index_of_last_word = (num_memo_dnodes >> 5);
    11821261
    11831262    if (bits_in_last_word != 0) {
     
    11881267  set_bitidx_vars(refbits, 0, bitsp, bits, bitidx);
    11891268  inbits = outbits = bits;
    1190   while (memo_dword < num_memo_dwords) {
     1269  while (memo_dnode < num_memo_dnodes) {
    11911270    if (bits == 0) {
    11921271      int remain = 0x20 - bitidx;
    1193       memo_dword += remain;
     1272      memo_dnode += remain;
    11941273      p += (remain+remain);
    11951274      if (outbits != inbits) {
     
    12021281      nextbit = count_leading_zeros(bits);
    12031282      if ((diff = (nextbit - bitidx)) != 0) {
    1204         memo_dword += diff;
     1283        memo_dnode += diff;
    12051284        bitidx = nextbit;
    12061285        p += (diff+diff);
     
    12151294        outbits &= ~(BIT0_MASK >> bitidx);
    12161295      }
    1217       memo_dword++;
     1296      memo_dnode++;
    12181297      bitidx++;
    12191298    }
     
    12211300  if (GCDebug) {
    12221301    p = (LispObj *) a->low;
    1223     check_refmap_consistency(p, p+(num_memo_dwords << 1), refbits);
     1302    check_refmap_consistency(p, p+(num_memo_dnodes << 1), refbits);
    12241303  }
    12251304}
     
    12351314  while (start < end) {
    12361315    x1 = *start;
    1237     if ((tag = fulltag_of(x1)) == fulltag_immheader) {
    1238       start = (LispObj *)skip_over_ivector((unsigned) start, x1);
    1239     } else if (tag != fulltag_nodeheader) {
     1316    tag = fulltag_of(x1);
     1317    if (immheader_tag_p(tag)) {
     1318      start = (LispObj *)ptr_from_lispobj(skip_over_ivector(ptr_to_lispobj(start), x1));
     1319    } else if (!nodeheader_tag_p(tag)) {
    12401320      ++start;
    12411321      mark_root(x1);
     
    12431323    } else {
    12441324      int subtag = header_subtag(x1);
    1245       int element_count = header_element_count(x1);
    1246       int size = (element_count+1 + 1) & ~1;
     1325      natural element_count = header_element_count(x1);
     1326      natural size = (element_count+1 + 1) & ~1;
    12471327
    12481328      if (subtag == subtag_hash_vector) {
     
    12771357}
    12781358
    1279 void
    1280 mark_dohs( void )
    1281 {
    1282   doh_block_ptr doh_block = (doh_block_ptr) lisp_global(DOH_HEAD);
    1283   while( doh_block ) {
    1284     mark_simple_area_range( &doh_block->data[0], &doh_block->data[doh_block_slots] );
    1285     doh_block = doh_block->link;
    1286   }
    1287 }
    12881359
    12891360/* Mark a tstack area */
     
    13011372       end != limit;
    13021373       current = next) {
    1303     next = (LispObj *) *current;
     1374    next = (LispObj *) ptr_from_lispobj(*current);
    13041375    end = ((next >= start) && (next < limit)) ? next : limit;
    13051376    if (current[1] == 0) {
     
    13781449    N.B. : elements 0 and 1 are already marked (or are immediate, etc.)
    13791450    */
    1380   LispObj *prev = ((LispObj *) untag(weakv))+(1+2), cell = *prev;
     1451  LispObj *prev = ((LispObj *) ptr_from_lispobj(untag(weakv))+(1+2)), cell = *prev;
    13811452  LispObj termination_list = lisp_nil;
    13821453  int weak_type = (int) deref(weakv,2);
     
    13851456  Boolean done = false;
    13861457  cons *rawcons;
    1387   unsigned dword, car_dword;
     1458  unsigned dnode, car_dnode;
    13881459  bitvector markbits = GCmarkbits;
    13891460
     
    13971468    /* weak alist */
    13981469    while (! done) {
    1399       dword = gc_area_dword(cell);
    1400       if ((dword >= GCndwords_in_area) ||
    1401           (ref_bit(markbits, dword))) {
     1470      dnode = gc_area_dnode(cell);
     1471      if ((dnode >= GCndnodes_in_area) ||
     1472          (ref_bit(markbits, dnode))) {
    14021473        done = true;
    14031474      } else {
     
    14061477        unsigned cell_tag;
    14071478
    1408         rawcons = (cons *) untag(cell);
     1479        rawcons = (cons *) ptr_from_lispobj(untag(cell));
    14091480        alist_cell = rawcons->car;
    14101481        cell_tag = fulltag_of(alist_cell);
    14111482
    14121483        if ((cell_tag == fulltag_cons) &&
    1413             ((car_dword = gc_area_dword(alist_cell)) < GCndwords_in_area) &&
    1414             (! ref_bit(markbits, car_dword)) &&
     1484            ((car_dnode = gc_area_dnode(alist_cell)) < GCndnodes_in_area) &&
     1485            (! ref_bit(markbits, car_dnode)) &&
    14151486            (is_node_fulltag(fulltag_of(thecar = car(alist_cell)))) &&
    1416             ((car_dword = gc_area_dword(thecar)) < GCndwords_in_area) &&
    1417             (! ref_bit(markbits, car_dword))) {
     1487            ((car_dnode = gc_area_dnode(thecar)) < GCndnodes_in_area) &&
     1488            (! ref_bit(markbits, car_dnode))) {
    14181489          *prev = rawcons->cdr;
    14191490          if (terminatablep) {
     
    14221493          }
    14231494        } else {
    1424           set_bit(markbits, dword);
     1495          set_bit(markbits, dnode);
    14251496          prev = (LispObj *)(&(rawcons->cdr));
    14261497          mark_root(alist_cell);
     
    14321503    /* weak list */
    14331504    while (! done) {
    1434       dword = gc_area_dword(cell);
    1435       if ((dword >= GCndwords_in_area) ||
    1436           (ref_bit(markbits, dword))) {
     1505      dnode = gc_area_dnode(cell);
     1506      if ((dnode >= GCndnodes_in_area) ||
     1507          (ref_bit(markbits, dnode))) {
    14371508        done = true;
    14381509      } else {
     
    14461517
    14471518        if (is_node_fulltag(cartag) &&
    1448             ((car_dword = gc_area_dword(thecar)) < GCndwords_in_area) &&
    1449             (! ref_bit(markbits, car_dword))) {
     1519            ((car_dnode = gc_area_dnode(thecar)) < GCndnodes_in_area) &&
     1520            (! ref_bit(markbits, car_dnode))) {
    14501521          *prev = rawcons->cdr;
    14511522          if (terminatablep) {
     
    14541525          }
    14551526        } else {
    1456           set_bit(markbits, dword);
     1527          set_bit(markbits, dnode);
    14571528          prev = (LispObj *)(&(rawcons->cdr));
    14581529        }
     
    14781549reaphashv(LispObj hashv)
    14791550{
    1480   hash_table_vector_header *hashp = (hash_table_vector_header *) untag(hashv);
    1481   unsigned
    1482     dword,
     1551  hash_table_vector_header
     1552    *hashp = (hash_table_vector_header *) ptr_from_lispobj(untag(hashv));
     1553  natural
     1554    dnode,
    14831555    npairs = (header_element_count(hashp->header) -
    14841556              ((sizeof(hash_table_vector_header)/sizeof(LispObj)) -1)) >> 1;
     
    14971569    tag = fulltag_of(weakelement);
    14981570    if (is_node_fulltag(tag)) {
    1499       dword = gc_area_dword(weakelement);
    1500       if ((dword < GCndwords_in_area) &&
    1501           ! ref_bit(markbits, dword)) {
     1571      dnode = gc_area_dnode(weakelement);
     1572      if ((dnode < GCndnodes_in_area) &&
     1573          ! ref_bit(markbits, dnode)) {
    15021574        pairp[0] = undefined;
    15031575        pairp[1] = lisp_nil;
     
    15141586mark_weak_hash_vector(hash_table_vector_header *hashp, unsigned elements)
    15151587{
    1516   unsigned flags = hashp->flags, key_dword, val_dword;
     1588  unsigned flags = hashp->flags, key_dnode, val_dnode;
    15171589  Boolean
    15181590    marked_new = false,
     
    15451617    val_tag = fulltag_of(val);
    15461618    if (is_node_fulltag(key_tag)) {
    1547       key_dword = gc_area_dword(key);
    1548       if ((key_dword < GCndwords_in_area) &&
    1549           ! ref_bit(GCmarkbits,key_dword)) {
     1619      key_dnode = gc_area_dnode(key);
     1620      if ((key_dnode < GCndnodes_in_area) &&
     1621          ! ref_bit(GCmarkbits,key_dnode)) {
    15501622        key_marked = false;
    15511623      }
    15521624    }
    15531625    if (is_node_fulltag(val_tag)) {
    1554       val_dword = gc_area_dword(val);
    1555       if ((val_dword < GCndwords_in_area) &&
    1556           ! ref_bit(GCmarkbits,val_dword)) {
     1626      val_dnode = gc_area_dnode(val);
     1627      if ((val_dnode < GCndnodes_in_area) &&
     1628          ! ref_bit(GCmarkbits,val_dnode)) {
    15571629        val_marked = false;
    15581630      }
     
    15791651{
    15801652  int elements = header_element_count(header_of(weak_alist));
    1581   unsigned dword;
     1653  unsigned dnode;
    15821654  int pair_tag;
    15831655  Boolean marked_new = false;
     
    15901662  for(alist = deref(weak_alist, elements);
    15911663      (fulltag_of(alist) == fulltag_cons) &&
    1592       ((dword = gc_area_dword(alist)) < GCndwords_in_area) &&
    1593       (! ref_bit(markbits,dword));
     1664      ((dnode = gc_area_dnode(alist)) < GCndnodes_in_area) &&
     1665      (! ref_bit(markbits,dnode));
    15941666      alist = cdr(alist)) {
    15951667    pair = car(alist);
    15961668    pair_tag = fulltag_of(pair);
    15971669    if ((is_node_fulltag(pair_tag)) &&
    1598         ((dword = gc_area_dword(pair_tag)) < GCndwords_in_area) &&
    1599         (! ref_bit(markbits,dword))) {
     1670        ((dnode = gc_area_dnode(pair_tag)) < GCndnodes_in_area) &&
     1671        (! ref_bit(markbits,dnode))) {
    16001672      if (pair_tag == fulltag_cons) {
    16011673        key = car(pair);
    16021674        if ((! is_node_fulltag(fulltag_of(key))) ||
    1603             ((dword = gc_area_dword(key)) >= GCndwords_in_area) ||
    1604             ref_bit(markbits,dword)) {
     1675            ((dnode = gc_area_dnode(key)) >= GCndnodes_in_area) ||
     1676            ref_bit(markbits,dnode)) {
    16051677          /* key is marked, mark value if necessary */
    16061678          value = cdr(pair);
    16071679          if (is_node_fulltag(fulltag_of(value)) &&
    1608               ((dword = gc_area_dword(value)) < GCndwords_in_area) &&
    1609               (! ref_bit(markbits,dword))) {
     1680              ((dnode = gc_area_dnode(value)) < GCndnodes_in_area) &&
     1681              (! ref_bit(markbits,dnode))) {
    16101682            mark_root(value);
    16111683            marked_new = true;
     
    17141786mark_xp(ExceptionInformation *xp)
    17151787{
    1716   unsigned long *regs = (unsigned long *) xpGPRvector(xp);
     1788  natural *regs = (natural *) xpGPRvector(xp);
    17171789  int r;
    17181790
     
    17881860  LispObj *prev = &(lisp_global(GCABLE_POINTERS)), next, ptr;
    17891861  xmacptr_flag flag;
    1790   unsigned dword;
     1862  unsigned dnode;
    17911863  xmacptr *x;
    17921864
    17931865  while((next = *prev) != (LispObj)NULL) {
    1794     dword = gc_area_dword(next);
    1795     x = (xmacptr *) untag(next);
    1796 
    1797     if ((dword >= GCndwords_in_area) ||
    1798         (ref_bit(GCmarkbits,dword))) {
     1866    dnode = gc_area_dnode(next);
     1867    x = (xmacptr *) ptr_from_lispobj(untag(next));
     1868
     1869    if ((dnode >= GCndnodes_in_area) ||
     1870        (ref_bit(GCmarkbits,dnode))) {
    17991871      prev = &(x->link);
    18001872    } else {
     
    18101882
    18111883        case xmacptr_flag_ptr:
    1812           deallocate((char *)ptr);
     1884          deallocate((char *)ptr_from_lispobj(ptr));
    18131885          break;
    18141886
     
    18631935/* A "pagelet" contains 32 doublewords.  The relocation table contains
    18641936   a word for each pagelet which defines the lowest address to which
    1865    dwords on that pagelet will be relocated.
     1937   dnodes on that pagelet will be relocated.
    18661938
    18671939   The relocation address of a given pagelet is the sum of the relocation
     
    18771949  bitvector markbits = GCmarkbits;
    18781950  unsigned char *bytep = (unsigned char *) markbits;
    1879   unsigned npagelets = ((GCndwords_in_area+31)>>5);
     1951  unsigned npagelets = ((GCndnodes_in_area+31)>>5);
    18801952  unsigned thesebits;
    18811953  LispObj first = 0;
     
    19061978
    19071979LispObj
    1908 dword_forwarding_address(unsigned dword, int tag_n)
     1980dnode_forwarding_address(unsigned dnode, int tag_n)
    19091981{
    19101982  unsigned pagelet, nbits;
     
    19131985
    19141986  if (GCDebug) {
    1915     if (! ref_bit(GCmarkbits, dword)) {
     1987    if (! ref_bit(GCmarkbits, dnode)) {
    19161988      Bug(NULL, "unmarked object being forwarded!\n");
    19171989    }
    19181990  }
    19191991
    1920   pagelet = dword >> 5;
    1921   nbits = dword & 0x1f;
    1922   near_bits = ((unsigned short *)GCmarkbits)[dword>>4];
     1992  pagelet = dnode >> 5;
     1993  nbits = dnode & 0x1f;
     1994  near_bits = ((unsigned short *)GCmarkbits)[dnode>>4];
    19231995
    19241996  if (nbits < 16) {
    19251997    new = GCrelocptr[pagelet] + tag_n;;
    1926     /* Increment "new" by the count of 1 bits which precede the dword */
     1998    /* Increment "new" by the count of 1 bits which precede the dnode */
    19271999    if (near_bits == 0xffff) {
    19282000      return (new + (nbits << 3));
     
    19552027{
    19562028  int tag_n = fulltag_of(obj);
    1957   unsigned dword;
     2029  unsigned dnode;
    19582030
    19592031  /* Locatives can be tagged as conses, "fulltag_misc"
     
    19622034     doesn't hurt to check ... */
    19632035
     2036#ifdef PPC64
     2037  if ((tag_n & lowtag_mask) != lowtag_primary) {
     2038    return obj;
     2039  }
     2040#else
    19642041  if ((1<<tag_n) & ((1<<fulltag_immheader) |
    19652042                    (1<<fulltag_nodeheader) |
     
    19682045    return obj;
    19692046  }
    1970 
    1971   dword = gc_area_dword(obj);
    1972 
    1973   if ((dword >= GCndwords_in_area) ||
     2047#endif
     2048
     2049  dnode = gc_area_dnode(obj);
     2050
     2051  if ((dnode >= GCndnodes_in_area) ||
    19742052      (obj < GCfirstunmarked)) {
    19752053    return obj;
    19762054  }
    19772055
    1978   return dword_forwarding_address(dword, tag_n);
     2056  return dnode_forwarding_address(dnode, tag_n);
    19792057}
    19802058
     
    19832061{
    19842062  int tag_n;
    1985   unsigned dword = gc_area_dword(node);
    1986 
    1987   if ((dword >= GCndwords_in_area) ||
     2063  unsigned dnode = gc_area_dnode(node);
     2064
     2065  if ((dnode >= GCndnodes_in_area) ||
    19882066      (node < GCfirstunmarked)) {
    19892067    return node;
     
    19952073  }
    19962074
    1997   return dword_forwarding_address(dword, tag_n);
     2075  return dnode_forwarding_address(dnode, tag_n);
    19982076}
    19992077
     
    20312109  while ((next = *prev) != (LispObj)NULL) {
    20322110    *prev = node_forwarding_address(next);
    2033     prev = &(((xmacptr *)(untag(next)))->link);
     2111    prev = &(((xmacptr *)ptr_from_lispobj(untag(next)))->link);
    20342112  }
    20352113}
     
    20452123    node = *p;
    20462124    tag_n = fulltag_of(node);
    2047     if (tag_n == fulltag_immheader) {
     2125    if (immheader_tag_p(tag_n)) {
    20482126      p = (LispObj *) skip_over_ivector((unsigned) p, node);
    2049     } else if (tag_n == fulltag_nodeheader) {
     2127    } else if (nodeheader_tag_p(tag_n)) {
    20502128      nwords = header_element_count(node);
    20512129      nwords += (1- (nwords&1));
     
    20962174
    20972175void
    2098 forward_memoized_area(area *a, unsigned num_memo_dwords)
     2176forward_memoized_area(area *a, unsigned num_memo_dnodes)
    20992177{
    21002178  bitvector refbits = a->refbits;
    21012179  LispObj *p = (LispObj *) a->low, x1, x2, new;
    2102   unsigned bits, bitidx, *bitsp, nextbit, diff, memo_dword = 0, hash_dword_limit = 0;
     2180  unsigned bits, bitidx, *bitsp, nextbit, diff, memo_dnode = 0, hash_dnode_limit = 0;
    21032181  int tag_x1;
    21042182  hash_table_vector_header *hashp = NULL;
     
    21062184
    21072185  if (GCDebug) {
    2108     check_refmap_consistency(p, p+(num_memo_dwords << 1), refbits);
     2186    check_refmap_consistency(p, p+(num_memo_dnodes << 1), refbits);
    21092187  }
    21102188
     
    21142192
    21152193  set_bitidx_vars(refbits, 0, bitsp, bits, bitidx);
    2116   while (memo_dword < num_memo_dwords) {
     2194  while (memo_dnode < num_memo_dnodes) {
    21172195    if (bits == 0) {
    21182196      int remain = 0x20 - bitidx;
    2119       memo_dword += remain;
     2197      memo_dnode += remain;
    21202198      p += (remain+remain);
    21212199      bits = *++bitsp;
     
    21242202      nextbit = count_leading_zeros(bits);
    21252203      if ((diff = (nextbit - bitidx)) != 0) {
    2126         memo_dword += diff;
     2204        memo_dnode += diff;
    21272205        bitidx = nextbit;
    21282206        p += (diff+diff);
     
    21322210      tag_x1 = fulltag_of(x1);
    21332211      bits &= ~(BIT0_MASK >> bitidx);
    2134       header_p = (tag_x1 == fulltag_nodeheader);
     2212      header_p = (nodeheader_tag_p(tag_x1));
    21352213
    21362214      if (header_p &&
     
    21382216        hashp = (hash_table_vector_header *) p;
    21392217        if (hashp->flags & nhash_track_keys_mask) {
    2140           hash_dword_limit = memo_dword + ((header_element_count(x1)+2)>>1);
     2218          hash_dnode_limit = memo_dnode + ((header_element_count(x1)+2)>>1);
    21412219        } else {
    21422220          hashp = NULL;
     
    21562234      if (new != x2) {
    21572235        *p = new;
    2158         if (memo_dword < hash_dword_limit) {
     2236        if (memo_dnode < hash_dnode_limit) {
    21592237          hashp->flags |= nhash_key_moved_mask;
    2160           hash_dword_limit = 0;
     2238          hash_dnode_limit = 0;
    21612239          hashp = NULL;
    21622240        }
    21632241      }
    21642242      p++;
    2165       memo_dword++;
     2243      memo_dnode++;
    21662244      bitidx++;
    21672245
     
    21702248}
    21712249
    2172 void
    2173 forward_dohs( void )
    2174 {
    2175   doh_block_ptr doh_block = (doh_block_ptr) lisp_global(DOH_HEAD);
    2176   while( doh_block ) {
    2177     forward_range( &doh_block->data[0], &doh_block->data[doh_block_slots] );
    2178     doh_block = doh_block->link;
    2179   }
    2180 }
    21812250
    21822251
     
    23062375{
    23072376  LispObj *src = (LispObj*) GCfirstunmarked, *dest = src, node, new;
    2308   unsigned elements, dword = gc_area_dword(GCfirstunmarked), node_dwords = 0, imm_dwords = 0;
     2377  unsigned elements, dnode = gc_area_dnode(GCfirstunmarked), node_dnodes = 0, imm_dnodes = 0;
    23092378  unsigned bitidx, *bitsp, bits, nextbit, diff;
    23102379  int tag;
     
    23142383  Boolean GCrelocated_code_vector = false;
    23152384
    2316   if (dword < GCndwords_in_area) {
     2385  if (dnode < GCndnodes_in_area) {
    23172386    lisp_global(FWDNUM) += (1<<fixnum_shift);
    23182387 
    2319     set_bitidx_vars(markbits,dword,bitsp,bits,bitidx);
    2320     while (dword < GCndwords_in_area) {
     2388    set_bitidx_vars(markbits,dnode,bitsp,bits,bitidx);
     2389    while (dnode < GCndnodes_in_area) {
    23212390      if (bits == 0) {
    23222391        int remain = 0x20 - bitidx;
    2323         dword += remain;
     2392        dnode += remain;
    23242393        src += (remain+remain);
    23252394        bits = *++bitsp;
     
    23292398           "bitidx" are 0.  Count leading zeros in "bits" (there'll be
    23302399           at least "bitidx" of them.)  If there are more than "bitidx"
    2331            leading zeros, bump "dword", "bitidx", and "src" by the difference. */
     2400           leading zeros, bump "dnode", "bitidx", and "src" by the difference. */
    23322401        nextbit = count_leading_zeros(bits);
    23332402        if ((diff = (nextbit - bitidx)) != 0) {
    2334           dword += diff;
     2403          dnode += diff;
    23352404          bitidx = nextbit;
    23362405          src += (diff+diff);
     
    23462415        node = *src++;
    23472416        tag = fulltag_of(node);
    2348         if (tag == fulltag_nodeheader) {
     2417        if (nodeheader_tag_p(tag)) {
    23492418          elements = header_element_count(node);
    2350           node_dwords = (elements+2)>>1;
    2351           dword += node_dwords;
     2419          node_dnodes = (elements+2)>>1;
     2420          dnode += node_dnodes;
    23522421          if ((header_subtag(node) == subtag_hash_vector) &&
    23532422              (((hash_table_vector_header *) (src-1))->flags & nhash_track_keys_mask)) {
     
    23842453            *dest++ = node;
    23852454            *dest++ = node_forwarding_address(*src++);
    2386             while(--node_dwords) {
     2455            while(--node_dnodes) {
    23872456              *dest++ = node_forwarding_address(*src++);
    23882457              *dest++ = node_forwarding_address(*src++);
    23892458            }
    23902459          }
    2391           set_bitidx_vars(markbits,dword,bitsp,bits,bitidx);
    2392         } else if (tag == fulltag_immheader) {
     2460          set_bitidx_vars(markbits,dnode,bitsp,bits,bitidx);
     2461        } else if (immheader_tag_p(tag)) {
    23932462          *dest++ = node;
    23942463          *dest++ = *src++;
    23952464          elements = header_element_count(node);
    23962465          tag = header_subtag(node);
     2466#ifdef PPC64
     2467          switch(fulltag_of(tag)) {
     2468          case ivector_class_64_bit:
     2469            imm_dnodes = ((elements+1)+1)>>1;
     2470            break;
     2471          case ivector_class_32_bit:
     2472            if (tag == subtag_code_vector) {
     2473              GCrelocated_code_vector = true;
     2474            }
     2475            imm_dnodes = (((elements+2)+3)>>2);
     2476            break;
     2477          case ivector_class_8_bit:
     2478            imm_dnodes = (((elements+8)+15)>>4);
     2479            break;
     2480          case ivector_class_other_bit:
     2481            if (tag == subtag_bit_vector) {
     2482              imm_dnodes = (((elements+64)+127)>>7);
     2483            } else {
     2484              imm_dnodes = (((elements+4)+7)>>3);
     2485            }
     2486          }
     2487#else
    23972488          if (tag <= max_32_bit_ivector_subtag) {
    23982489            if (tag == subtag_code_vector) {
    23992490              GCrelocated_code_vector = true;
    24002491            }
    2401             imm_dwords = (((elements+1)+1)>>1);
     2492            imm_dnodes = (((elements+1)+1)>>1);
    24022493          } else if (tag <= max_8_bit_ivector_subtag) {
    2403             imm_dwords = (((elements+4)+7)>>3);
     2494            imm_dnodes = (((elements+4)+7)>>3);
    24042495          } else if (tag <= max_16_bit_ivector_subtag) {
    2405             imm_dwords = (((elements+2)+3)>>2);
     2496            imm_dnodes = (((elements+2)+3)>>2);
    24062497          } else if (tag == subtag_bit_vector) {
    2407             imm_dwords = (((elements+32)+63)>>6);
     2498            imm_dnodes = (((elements+32)+63)>>6);
    24082499          } else {
    2409             imm_dwords = elements+1;
     2500            imm_dnodes = elements+1;
    24102501          }
    2411           dword += imm_dwords;
    2412           while (--imm_dwords) {
     2502#endif
     2503          dnode += imm_dnodes;
     2504          while (--imm_dnodes) {
    24132505            *dest++ = *src++;
    24142506            *dest++ = *src++;
    24152507          }
    2416           set_bitidx_vars(markbits,dword,bitsp,bits,bitidx);
     2508          set_bitidx_vars(markbits,dnode,bitsp,bits,bitidx);
    24172509        } else {
    24182510          *dest++ = node_forwarding_address(node);
    24192511          *dest++ = node_forwarding_address(*src++);
    24202512          bits &= ~(BIT0_MASK >> bitidx);
    2421           dword++;
     2513          dnode++;
    24222514          bitidx++;
    24232515        }
     
    24272519
    24282520    {
    2429       unsigned nbytes = (unsigned)dest - (unsigned)GCfirstunmarked;
     2521      natural nbytes = (natural)dest - (natural)GCfirstunmarked;
    24302522      if ((nbytes != 0) && GCrelocated_code_vector) {
    2431         xMakeDataExecutable((LogicalAddress)GCfirstunmarked, nbytes);
    2432       }
    2433     }
    2434   }
    2435   return (LispObj)dest;
     2523        xMakeDataExecutable((LogicalAddress)ptr_from_lispobj(GCfirstunmarked), nbytes);
     2524      }
     2525    }
     2526  }
     2527  return ptr_to_lispobj(dest);
    24362528}
    24372529
     
    24862578  GCephemeral_low = lisp_global(OLDEST_EPHEMERAL);
    24872579  if (GCephemeral_low) {
    2488     GCn_ephemeral_dwords=area_dword(oldfree, GCephemeral_low);
     2580    GCn_ephemeral_dnodes=area_dnode(oldfree, GCephemeral_low);
    24892581    update_area_refmaps(oldfree);
    24902582  } else {
     
    24922584      unprotect_area(oldspace_protected_area);
    24932585    }
    2494     GCn_ephemeral_dwords = 0;
     2586    GCn_ephemeral_dnodes = 0;
    24952587  }
    24962588 
     
    25312623     
    25322624  GCmarkbits = a->markbits;
    2533   GCarealow = (LispObj) a->low,
    2534   GCndwords_in_area = gc_area_dword(oldfree);
    2535 
    2536   zero_bits(GCmarkbits, GCndwords_in_area);
     2625  GCarealow = ptr_to_lispobj(a->low);
     2626  GCndnodes_in_area = gc_area_dnode(oldfree);
     2627
     2628  zero_bits(GCmarkbits, GCndnodes_in_area);
    25372629  GCweakvll = (LispObj)NULL;
    25382630
    25392631
    2540   if (GCn_ephemeral_dwords == 0) {
     2632  if (GCn_ephemeral_dnodes == 0) {
    25412633    /* For GCTWA, mark the internal package hash table vector of
    25422634     *PACKAGE*, but don't mark its contents. */
     
    25452637        itab;
    25462638      unsigned
    2547         dword, ndwords;
     2639        dnode, ndnodes;
    25482640     
    25492641      pkg = nrs_PACKAGE.vcell;
    25502642      if ((fulltag_of(pkg) == fulltag_misc) &&
    25512643          (header_subtag(header_of(pkg)) == subtag_package)) {
    2552         itab = ((package *)(untag(pkg)))->itab;
     2644        itab = ((package *)ptr_from_lispobj(untag(pkg)))->itab;
    25532645        itabvec = car(itab);
    2554         dword = gc_area_dword(itabvec);
    2555         if (dword < GCndwords_in_area) {
    2556           ndwords = (header_element_count(header_of(itabvec))+1) >> 1;
    2557           set_n_bits(GCmarkbits, dword, ndwords);
     2646        dnode = gc_area_dnode(itabvec);
     2647        if (dnode < GCndnodes_in_area) {
     2648          ndnodes = (header_element_count(header_of(itabvec))+1) >> 1;
     2649          set_n_bits(GCmarkbits, dnode, ndnodes);
    25582650        }
    25592651      }
     
    25992691 
    26002692  if (lisp_global(OLDEST_EPHEMERAL)) {
    2601     mark_memoized_area(tenured_area, area_dword(a->low,tenured_area->low));
     2693    mark_memoized_area(tenured_area, area_dnode(a->low,tenured_area->low));
    26022694  }
    26032695
     
    26092701  } while (other_tcr != tcr);
    26102702
    2611   mark_dohs();          /* Creole */
    26122703
    26132704
     
    26292720      if (fulltag_of(sym) == fulltag_misc) {
    26302721        lispsymbol *rawsym = (lispsymbol *)(untag(sym));
    2631         unsigned dword = gc_area_dword(sym);
     2722        unsigned dnode = gc_area_dnode(sym);
    26322723         
    2633         if ((dword < GCndwords_in_area) &&
    2634             (!ref_bit(GCmarkbits,dword))) {
     2724        if ((dnode < GCndnodes_in_area) &&
     2725            (!ref_bit(GCmarkbits,dnode))) {
    26352726          /* Symbol is in GC area, not marked.
    26362727             Mark it if fboundp, boundp, or if
     
    26642755      if (fulltag_of(sym) == fulltag_misc) {
    26652756        lispsymbol *rawsym = (lispsymbol *)(untag(sym));
    2666         unsigned dword = gc_area_dword(sym);
    2667 
    2668         if ((dword < GCndwords_in_area) &&
    2669             (!ref_bit(GCmarkbits,dword))) {
    2670           *raw = unbound;
     2757        unsigned dnode = gc_area_dnode(sym);
     2758
     2759        if ((dnode < GCndnodes_in_area) &&
     2760            (!ref_bit(GCmarkbits,dnode))) {
     2761          *raw = unbound_marker;
    26712762        }
    26722763      }
     
    26882779  } while (other_tcr != tcr);
    26892780
    2690   forward_dohs();               /* Creole */
    26912781 
    26922782  forward_gcable_ptrs();
     
    27282818 
    27292819  if (GCephemeral_low) {
    2730     forward_memoized_area(tenured_area, area_dword(a->low, tenured_area->low));
     2820    forward_memoized_area(tenured_area, area_dnode(a->low, tenured_area->low));
    27312821  }
    27322822
     
    28022892        (header_subtag(header_of(val)) == subtag_macptr)) {
    28032893      long long justfreed = oldfree - a->active;
    2804       *( (long long *) ((macptr *) (untag(val)))->address) += justfreed;
     2894      *( (long long *) ((macptr *) ptr_from_lispobj(untag(val)))->address) += justfreed;
    28052895    }
    28062896  }
     
    28232913    tag = fulltag_of(header);
    28242914   
    2825     if ((tag == fulltag_nodeheader) ||
    2826         (tag == fulltag_immheader)) {
     2915    if ((nodeheader_tag_p(tag)) ||
     2916        (immheader_tag_p(tag))) {
    28272917      elements = header_element_count(header);
    2828       if (tag == fulltag_nodeheader) {
     2918      if (nodeheader_tag_p(tag)) {
    28292919        start += ((elements+2) & ~1);
    28302920      } else {
    28312921        subtag = header_subtag(header);
    28322922
     2923#ifdef PPC64
     2924        switch(fulltag_of(header)) {
     2925        case ivector_class_64_bit:
     2926          bytes = 8 + (elements<<3);
     2927          break;
     2928        case ivector_class_32_bit:
     2929          bytes = 8 + (elements<<2);
     2930          break;
     2931        case ivector_class_8_bit:
     2932          bytes = 8 + elements;
     2933          break;
     2934        case ivector_class_other_bit:
     2935        default:
     2936          if (subtag == subtag_bit_vector) {
     2937            bytes = 8 + ((elements+7)>>3);
     2938          } else {
     2939            bytes = 8 + (elements<<1);
     2940          }
     2941        }
     2942#else
    28332943        if (subtag <= max_32_bit_ivector_subtag) {
    28342944          bytes = 4 + (elements<<2);
     
    28422952          bytes = 4 + ((elements+7)>>3);
    28432953        }
    2844         bytes = (bytes+7) & ~7;
     2954#endif
     2955        bytes = (bytes+dnode_size-1) & ~(dnode_size-1);
    28452956        total += bytes;
    2846         start += (bytes >> 2);
     2957        start += (bytes >> node_shift);
    28472958      }
    28482959    } else {
     
    28662977  BytePtr
    28672978    free = dest->active,
    2868     *old = (BytePtr *) untag(obj);
     2979    *old = (BytePtr *) ptr_from_lispobj(untag(obj));
    28692980  LispObj
    28702981    header = header_of(obj),
     
    28802991    break;
    28812992
    2882   case subtag_simple_general_string:
    2883     physbytes = 4 + (element_count << 1);
    2884     break;
    2885 
    28862993  case subtag_code_vector:
    28872994    physbytes = 4 + (element_count << 2);
     
    28953002  dest->active += physbytes;
    28963003
    2897   new = (LispObj)free+disp;
     3004  new = ptr_to_lispobj(free)+disp;
    28983005
    28993006  memcpy(free, (BytePtr)old, physbytes);
     
    29043011     look like a header.
    29053012     b) We'd like to be able to forward code-vector locatives, and
    2906      it's easiest to do so if we leave a {forward_marker, dword_locative}
     3013     it's easiest to do so if we leave a {forward_marker, dnode_locative}
    29073014     pair at every doubleword in the old vector.
    29083015     */
     
    29343041
    29353042  if ((tag == fulltag_misc) &&
    2936       (((BytePtr)obj) > low) &&
    2937       (((BytePtr)obj) < high)) {
     3043      (((BytePtr)ptr_from_lispobj(obj)) > low) &&
     3044      (((BytePtr)ptr_from_lispobj(obj)) < high)) {
    29383045    header = deref(obj, 0);
    29393046    if (header == forward_marker) { /* already copied */
     
    29413048    } else {
    29423049      header_tag = fulltag_of(header);
    2943       if (header_tag == fulltag_immheader) {
     3050      if (immheader_tag_p(header_tag)) {
    29443051        header_subtag = header_subtag(header);
    29453052        if (((header_subtag == subtag_code_vector) && (what_to_copy & COPY_CODE)) ||
    29463053            ((what_to_copy & COPY_STRINGS) &&
    2947              ((header_subtag == subtag_simple_base_string) ||
    2948               (header_subtag == subtag_simple_general_string)))) {
     3054             ((header_subtag == subtag_simple_base_string)))) {
    29493055          *ref = purify_object(obj, dest);
    29503056        }
     
    29633069    tag = fulltag_of(loc);
    29643070
    2965   if (((BytePtr)loc > low) &&
    2966       ((BytePtr)loc < high)) {
    2967     LispObj *p = (LispObj *)(untag(loc));
     3071  if (((BytePtr)ptr_from_lispobj(loc) > low) &&
     3072      ((BytePtr)ptr_from_lispobj(loc) < high)) {
     3073    LispObj *p = (LispObj *)ptr_from_lispobj(untag(loc));
    29683074    switch (tag) {
    29693075    case fulltag_even_fixnum:
     
    29803086          header = *p;
    29813087        } while ((header & code_header_mask) != subtag_code_vector);
    2982         *locaddr = purify_displaced_object((LispObj)p, to, tag);
     3088        *locaddr = purify_displaced_object(ptr_to_lispobj(p), to, tag);
    29833089      }
    29843090      break;
     
    30033109    } else {
    30043110      tag = fulltag_of(header);
    3005       if (tag == fulltag_immheader) {
     3111      if (immheader_tag_p(tag)) {
    30063112        start = (LispObj *)skip_over_ivector((unsigned)start, header);
    30073113      } else {
    3008         if (tag != fulltag_nodeheader) {
     3114        if (!nodeheader_tag_p(tag)) {
    30093115          copy_ivector_reference(start, low, high, to, what);
    30103116        }
     
    30313137       end != limit;
    30323138       current = next) {
    3033     next = (LispObj *) *current;
     3139    next = (LispObj *) ptr_from_lispobj(*current);
    30343140    end = ((next >= start) && (next < limit)) ? next : limit;
    30353141    if (current[1] == 0) {
     
    31263232}
    31273233
    3128 void
    3129 purify_dohs(BytePtr low, BytePtr high, area *to, int what)
    3130 {
    3131   doh_block_ptr doh_block = (doh_block_ptr) lisp_global(DOH_HEAD);
    3132   while( doh_block ) {
    3133     purify_range( &doh_block->data[0], &doh_block->data[doh_block_slots],
    3134                  low, high, to, what );
    3135     doh_block = doh_block->link;
    3136   }
    3137 }
    31383234
    31393235void
     
    32173313
    32183314      while (fulltag_of(pkg_list) == fulltag_cons) {
    3219         c = (cons *) untag(pkg_list);
    3220         p = (package *) untag(c->car);
     3315        c = (cons *) ptr_from_lispobj(untag(pkg_list));
     3316        p = (package *) ptr_from_lispobj(untag(c->car));
    32213317        pkg_list = c->cdr;
    3222         c = (cons *) untag(p->itab);
     3318        c = (cons *) ptr_from_lispobj(untag(p->itab));
    32233319        htab = c->car;
    32243320        elements = header_element_count(header_of(htab));
     
    32263322          obj = deref(htab,i);
    32273323          if (fulltag_of(obj) == fulltag_misc) {
    3228             rawsym = (lispsymbol *) untag(obj);
     3324            rawsym = (lispsymbol *) ptr_from_lispobj(untag(obj));
    32293325            copy_ivector_reference(&(rawsym->pname), a->low, a->active, new_pure_area, COPY_STRINGS);
    32303326          }
    32313327        }
    3232         c = (cons *) untag(p->etab);
     3328        c = (cons *) ptr_from_lispobj(untag(p->etab));
    32333329        htab = c->car;
    32343330        elements = header_element_count(header_of(htab));
     
    32363332          obj = deref(htab,i);
    32373333          if (fulltag_of(obj) == fulltag_misc) {
    3238             rawsym = (lispsymbol *) untag(obj);
     3334            rawsym = (lispsymbol *) ptr_from_lispobj(untag(obj));
    32393335            copy_ivector_reference(&(rawsym->pname), a->low, a->active, new_pure_area, COPY_STRINGS);
    32403336          }
     
    32523348    } while (other_tcr != tcr);
    32533349
    3254     purify_dohs(a->low, a->active, new_pure_area, COPY_CODE);
    32553350
    32563351    {
     
    33543449    header = *start;
    33553450    tag = fulltag_of(header);
    3356     if (tag == fulltag_immheader) {
     3451    if (immheader_tag_p(tag)) {
    33573452      start = (LispObj *)skip_over_ivector((unsigned)start, header);
    33583453    } else {
    3359       if (tag != fulltag_nodeheader) {
     3454      if (!nodeheader_tag_p(tag)) {
    33603455        impurify_noderef(start, low, high, delta);
    33613456        }
     
    34083503       end != limit;
    34093504       current = next) {
    3410     next = (LispObj *) *current;
     3505    next = (LispObj *) ptr_from_lispobj(*current);
    34113506    end = ((next >= start) && (next < limit)) ? next : limit;
    34123507    if (current[1] == 0) {
     
    34793574      bcopy(ro_base, oldfree, n);
    34803575      munmap(ro_base, n);
    3481       a->ndwords = area_dword(a, a->active);
     3576      a->ndnodes = area_dnode(a, a->active);
    34823577      pure_space_active = r->active = r->low;
    3483       r->ndwords = 0;
    3484 
    3485       impurify_areas((LispObj)ro_base, (LispObj)ro_limit, delta);
     3578      r->ndnodes = 0;
     3579
     3580      impurify_areas(ptr_to_lispobj(ro_base), ptr_to_lispobj(ro_limit), delta);
    34863581
    34873582      other_tcr = tcr;
    34883583      do {
    3489         impurify_tcr_xframes(other_tcr, (LispObj)ro_base, (LispObj)ro_limit, delta);
    3490         impurify_tcr_tlb(other_tcr, (LispObj)ro_base, (LispObj)ro_limit, delta);
     3584        impurify_tcr_xframes(other_tcr, ptr_to_lispobj(ro_base), ptr_to_lispobj(ro_limit), delta);
     3585        impurify_tcr_tlb(other_tcr, ptr_to_lispobj(ro_base), ptr_to_lispobj(ro_limit), delta);
    34913586        other_tcr = other_tcr->next;
    34923587      } while (other_tcr != tcr);
Note: See TracChangeset for help on using the changeset viewer.