Changeset 15367


Ignore:
Timestamp:
May 19, 2012, 3:27:04 PM (13 years ago)
Author:
Gary Byers
Message:

arm-gc.c: mark_memoized_area() does nothing if area is empty.
arm-spentry.s: In _SPbuiltin_eql, if recursive call on first
element of ratio/complex returns NIL, return NIL explicitly
(we pop arg_y/arg_z).

Automatic build tools likely don't read these comments and will
probably try to rebuild x86 versions.

Location:
trunk/source/lisp-kernel
Files:
2 edited

Legend:

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

    r15093 r15367  
    801801  int mark_method = 3;
    802802
    803   if (GCDebug) {
    804     check_refmap_consistency(p, p+(num_memo_dnodes << 1), refbits);
    805   }
    806 
    807   /* The distinction between "inbits" and "outbits" is supposed to help us
    808      detect cases where "uninteresting" setfs have been memoized.  Storing
    809      NIL, fixnums, immediates (characters, etc.) or node pointers to static
    810      or readonly areas is definitely uninteresting, but other cases are
    811      more complicated (and some of these cases are hard to detect.)
    812 
    813      Some headers are "interesting", to the forwarder if not to us.
    814 
    815      */
    816 
    817   /*
    818     We need to ensure that there are no bits set at or beyond
    819     "num_memo_dnodes" in the bitvector.  (This can happen as the EGC
    820     tenures/untenures things.)  We find bits by grabbing a fullword at
    821     a time and doing a cntlzw instruction; and don't want to have to
    822     check for (< memo_dnode num_memo_dnodes) in the loop.
     803  if (num_memo_dnodes) {
     804    if (GCDebug) {
     805      check_refmap_consistency(p, p+(num_memo_dnodes << 1), refbits);
     806    }
     807
     808    /* The distinction between "inbits" and "outbits" is supposed to help us
     809       detect cases where "uninteresting" setfs have been memoized.  Storing
     810       NIL, fixnums, immediates (characters, etc.) or node pointers to static
     811       or readonly areas is definitely uninteresting, but other cases are
     812       more complicated (and some of these cases are hard to detect.)
     813
     814       Some headers are "interesting", to the forwarder if not to us.
     815
    823816    */
    824817
    825   {
    826     natural
    827       bits_in_last_word = (num_memo_dnodes & bitmap_shift_count_mask),
    828       index_of_last_word = (num_memo_dnodes >> bitmap_shift);
    829 
    830     if (bits_in_last_word != 0) {
    831       natural mask = ~((1L<<(nbits_in_word-bits_in_last_word))-1L);
    832       refbits[index_of_last_word] &= mask;
    833     }
    834   }
     818    /*
     819      We need to ensure that there are no bits set at or beyond
     820      "num_memo_dnodes" in the bitvector.  (This can happen as the EGC
     821      tenures/untenures things.)  We find bits by grabbing a fullword at
     822      a time and doing a cntlzw instruction; and don't want to have to
     823      check for (< memo_dnode num_memo_dnodes) in the loop.
     824    */
     825
     826    {
     827      natural
     828        bits_in_last_word = (num_memo_dnodes & bitmap_shift_count_mask),
     829        index_of_last_word = (num_memo_dnodes >> bitmap_shift);
     830
     831      if (bits_in_last_word != 0) {
     832        natural mask = ~((1L<<(nbits_in_word-bits_in_last_word))-1L);
     833        refbits[index_of_last_word] &= mask;
     834      }
     835    }
    835836       
    836   set_bitidx_vars(refbits, 0, bitsp, bits, bitidx);
    837   inbits = outbits = bits;
    838   while (memo_dnode < num_memo_dnodes) {
    839     if (bits == 0) {
    840       int remain = nbits_in_word - bitidx;
    841       memo_dnode += remain;
    842       p += (remain+remain);
    843       if (outbits != inbits) {
    844         *bitsp = outbits;
    845       }
    846       bits = *++bitsp;
    847       inbits = outbits = bits;
    848       bitidx = 0;
    849     } else {
    850       nextbit = count_leading_zeros(bits);
    851       if ((diff = (nextbit - bitidx)) != 0) {
    852         memo_dnode += diff;
    853         bitidx = nextbit;
    854         p += (diff+diff);
    855       }
    856       x1 = *p++;
    857       x2 = *p++;
    858       bits &= ~(BIT0_MASK >> bitidx);
    859 
    860       if (hashp) {
    861         Boolean force_x1 = false;
    862         if ((memo_dnode >= hash_dnode_limit) && (mark_method == 3)) {
    863           /* if vector_header_count is odd, x1 might be the last word of the header */
    864           force_x1 = (hash_table_vector_header_count & 1) && (memo_dnode == hash_dnode_limit);
    865           /* was marking header, switch to data */
    866           hash_dnode_limit = area_dnode(((LispObj *)hashp)
    867                                         + 1
    868                                         + header_element_count(hashp->header),
    869                                         a->low);
    870           /* In traditional weak method, don't mark vector entries at all. */
    871           /* Otherwise mark the non-weak elements only */
    872           mark_method = ((lisp_global(WEAK_GC_METHOD) == 0) ? 0 :
    873                          ((hashp->flags & nhash_weak_value_mask)
    874                           ? (1 + (hash_table_vector_header_count & 1))
    875                           : (2 - (hash_table_vector_header_count & 1))));
    876         }
    877 
    878         if (memo_dnode < hash_dnode_limit) {
    879           /* perhaps ignore one or both of the elements */
    880           if (!force_x1 && !(mark_method & 1)) x1 = 0;
    881           if (!(mark_method & 2)) x2 = 0;
    882         } else {
    883           hashp = NULL;
    884         }
    885       }
    886 
    887       if (header_subtag(x1) == subtag_hash_vector) {
    888         if (hashp) Bug(NULL, "header inside hash vector?");
    889         hash_table_vector_header *hp = (hash_table_vector_header *)(p - 2);
    890         if (hp->flags & nhash_weak_mask) {
    891           /* Workaround for ticket:817 */
    892           if (!(hp->flags & nhash_weak_value_mask)) {
    893             /* If header_count is odd, this cuts off the last header field */
    894             /* That case is handled specially above */
    895             hash_dnode_limit = memo_dnode + ((hash_table_vector_header_count) >>1);
    896             hashp = hp;
    897             mark_method = 3;
     837    set_bitidx_vars(refbits, 0, bitsp, bits, bitidx);
     838    inbits = outbits = bits;
     839    while (memo_dnode < num_memo_dnodes) {
     840      if (bits == 0) {
     841        int remain = nbits_in_word - bitidx;
     842        memo_dnode += remain;
     843        p += (remain+remain);
     844        if (outbits != inbits) {
     845          *bitsp = outbits;
     846        }
     847        bits = *++bitsp;
     848        inbits = outbits = bits;
     849        bitidx = 0;
     850      } else {
     851        nextbit = count_leading_zeros(bits);
     852        if ((diff = (nextbit - bitidx)) != 0) {
     853          memo_dnode += diff;
     854          bitidx = nextbit;
     855          p += (diff+diff);
     856        }
     857        x1 = *p++;
     858        x2 = *p++;
     859        bits &= ~(BIT0_MASK >> bitidx);
     860
     861        if (hashp) {
     862          Boolean force_x1 = false;
     863          if ((memo_dnode >= hash_dnode_limit) && (mark_method == 3)) {
     864            /* if vector_header_count is odd, x1 might be the last word of the header */
     865            force_x1 = (hash_table_vector_header_count & 1) && (memo_dnode == hash_dnode_limit);
     866            /* was marking header, switch to data */
     867            hash_dnode_limit = area_dnode(((LispObj *)hashp)
     868                                          + 1
     869                                          + header_element_count(hashp->header),
     870                                          a->low);
     871            /* In traditional weak method, don't mark vector entries at all. */
     872            /* Otherwise mark the non-weak elements only */
     873            mark_method = ((lisp_global(WEAK_GC_METHOD) == 0) ? 0 :
     874                           ((hashp->flags & nhash_weak_value_mask)
     875                            ? (1 + (hash_table_vector_header_count & 1))
     876                            : (2 - (hash_table_vector_header_count & 1))));
    898877          }
    899         }
    900       }
    901 
    902       keep_x1 = mark_ephemeral_root(x1);
    903       keep_x2 = mark_ephemeral_root(x2);
    904       if ((keep_x1 == false) &&
    905           (keep_x2 == false) &&
    906           (hashp == NULL)) {
    907         outbits &= ~(BIT0_MASK >> bitidx);
    908       }
    909       memo_dnode++;
    910       bitidx++;
    911     }
    912   }
    913   if (GCDebug) {
    914     p = (LispObj *) a->low;
    915     check_refmap_consistency(p, p+(num_memo_dnodes << 1), refbits);
     878
     879          if (memo_dnode < hash_dnode_limit) {
     880            /* perhaps ignore one or both of the elements */
     881            if (!force_x1 && !(mark_method & 1)) x1 = 0;
     882            if (!(mark_method & 2)) x2 = 0;
     883          } else {
     884            hashp = NULL;
     885          }
     886        }
     887
     888        if (header_subtag(x1) == subtag_hash_vector) {
     889          if (hashp) Bug(NULL, "header inside hash vector?");
     890          hash_table_vector_header *hp = (hash_table_vector_header *)(p - 2);
     891          if (hp->flags & nhash_weak_mask) {
     892            /* Workaround for ticket:817 */
     893            if (!(hp->flags & nhash_weak_value_mask)) {
     894              /* If header_count is odd, this cuts off the last header field */
     895              /* That case is handled specially above */
     896              hash_dnode_limit = memo_dnode + ((hash_table_vector_header_count) >>1);
     897              hashp = hp;
     898              mark_method = 3;
     899            }
     900          }
     901        }
     902
     903        keep_x1 = mark_ephemeral_root(x1);
     904        keep_x2 = mark_ephemeral_root(x2);
     905        if ((keep_x1 == false) &&
     906            (keep_x2 == false) &&
     907            (hashp == NULL)) {
     908          outbits &= ~(BIT0_MASK >> bitidx);
     909        }
     910        memo_dnode++;
     911        bitidx++;
     912      }
     913    }
     914    if (GCDebug) {
     915      p = (LispObj *) a->low;
     916      check_refmap_consistency(p, p+(num_memo_dnodes << 1), refbits);
     917    }
    916918  }
    917919}
  • trunk/source/lisp-kernel/arm-spentry.s

    r15338 r15367  
    197197        __(ldmia vsp!,{arg_z,arg_y})
    198198        __(bne 0b)
     199        __(mov arg_z,#nil_value)
    199200        __(bx lr)
    2002013:      __(cmp imm0,#subtag_bignum)
     
    31853186        __(mov r0,sp)
    31863187        __(sub sp,sp,#2*node_size) /* room for result */
     3188        __(fstmdbd sp!,{d0-d7})
    31873189        __(stmdb sp!,{r4,r5,r6,r7,r8,r9,r10,r11,r12,lr})
    31883190        __(mov r4,r0)
     
    32293231        __(ldr sp,[sp,#node_size*2])   /* drop the ivector that hides foreign stack contents and restore (possibly misaligned) sp */
    32303232        __(ldmia sp!,{r4,r5,r6,r7,r8,r9,r10,r11,r12,lr})
     3233        __(add sp,sp,#8*8)
     3234        __(fldd d0,[sp,#0])
    32313235        __(ldmia sp!,{r0,r1})
    32323236        __(add sp,sp,#4*node_size)
Note: See TracChangeset for help on using the changeset viewer.