Changeset 14723


Ignore:
Timestamp:
Apr 21, 2011, 9:20:04 PM (8 years ago)
Author:
gb
Message:

In mark_memoized_area() on all platforms, don't do any special
processing of weak-on-value hash vectors. (This means that otherwise
unreferenced values in weak-on-value hash tables will only be free
on a full GC.) This seems to fix (at least the symptom of) ticket:817,
or at least allows my test case to run to completion.

The real problem is that sometimes those weak-on-value hash vectors
aren't on GCweakvll; if we don't mark the values in the weak vector
in mark_memoized_area(), nothing deletes unmarked values from the
hash table (or otherwise completes weak processing.) I was unable
to determine why the vectors were sometimes missing from the list;
not dropping them in init_weakvll() didn't seem to fix anything.

One approach to fixing the real problem is to say:

  • we somehow ensure that tenured weak-on-value hash vectors always have refbits set for their headers.
  • on entry to the GC, GCweakvll is empty (or at least contains no hash vectors).
  • mark_memoized_area does weak processing of all tenured weak hash vectors. If it finds that the vector contains intergenerational references to weak elements, it pushes the vector on GCweakvll.
  • if lisp_global(WEAKVLL) and init_weakvll() need to continue to exist, that's only so that weak list headers can be preprocessed. It'd be nice to think of a way of doing that preprocessing via other means.
Location:
trunk/source/lisp-kernel
Files:
3 edited

Legend:

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

    r14495 r14723  
    887887        hash_table_vector_header *hp = (hash_table_vector_header *)(p - 2);
    888888        if (hp->flags & nhash_weak_mask) {
    889           /* If header_count is odd, this cuts off the last header field */
    890           /* That case is handled specially above */
    891           hash_dnode_limit = memo_dnode + ((hash_table_vector_header_count) >>1);
    892           hashp = hp;
    893           mark_method = 3;
     889          /* Workaround for ticket:817 */
     890          if (!(hp->flags & nhash_weak_value_mask)) {
     891            /* If header_count is odd, this cuts off the last header field */
     892            /* That case is handled specially above */
     893            hash_dnode_limit = memo_dnode + ((hash_table_vector_header_count) >>1);
     894            hashp = hp;
     895            mark_method = 3;
     896          }
    894897        }
    895898      }
  • trunk/source/lisp-kernel/ppc-gc.c

    r14197 r14723  
    929929     Some headers are "interesting", to the forwarder if not to us.
    930930
    931      */
     931  */
    932932
    933933  /*
     
    937937    a time and doing a cntlzw instruction; and don't want to have to
    938938    check for (< memo_dnode num_memo_dnodes) in the loop.
    939     */
     939  */
    940940
    941941  {
     
    10041004        if (hashp) Bug(NULL, "header inside hash vector?");
    10051005        hash_table_vector_header *hp = (hash_table_vector_header *)(p - 2);
    1006         if (hp->flags & nhash_weak_mask) {
    1007           /* If header_count is odd, this cuts off the last header field */
    1008           /* That case is handled specially above */
    1009           hash_dnode_limit = memo_dnode + ((hash_table_vector_header_count) >>1);
    1010           hashp = hp;
    1011           mark_method = 3;
     1006        /* Workaround for ticket:817 */
     1007        if (!(hp->flags & nhash_weak_value_mask)) {
     1008          if (hp->flags & nhash_weak_mask) {
     1009            /* If header_count is odd, this cuts off the last header field */
     1010            /* That case is handled specially above */
     1011            hash_dnode_limit = memo_dnode + ((hash_table_vector_header_count) >>1);
     1012            hashp = hp;
     1013            mark_method = 3;
     1014          }
    10121015        }
    10131016      }
  • trunk/source/lisp-kernel/x86-gc.c

    r14619 r14723  
    12541254     Some headers are "interesting", to the forwarder if not to us.
    12551255
    1256      */
     1256  */
    12571257
    12581258  /*
     
    12621262    a time and doing a cntlzw instruction; and don't want to have to
    12631263    check for (< memo_dnode num_memo_dnodes) in the loop.
    1264     */
     1264  */
    12651265
    12661266  {
     
    12981298      x2 = *p++;
    12991299      bits &= ~(BIT0_MASK >> bitidx);
     1300
    13001301
    13011302      if (hashp) {
     
    13301331        hash_table_vector_header *hp = (hash_table_vector_header *)(p - 2);
    13311332        if (hp->flags & nhash_weak_mask) {
    1332           /* If header_count is odd, this cuts off the last header field */
    1333           /* That case is handled specially above */
    1334           hash_dnode_limit = memo_dnode + ((hash_table_vector_header_count) >>1);
    1335           hashp = hp;
    1336           mark_method = 3;
     1333          /* Work around the issue that seems to cause ticket:817,
     1334             which is that tenured hash vectors that are weak on value
     1335             aren't always maintained on GCweakvll.  If they aren't and
     1336             we process them weakly here, nothing will delete the unreferenced
     1337             elements. */
     1338          if (!(hp->flags & nhash_weak_value_mask)) {
     1339            /* If header_count is odd, this cuts off the last header field */
     1340            /* That case is handled specially above */
     1341            hash_dnode_limit = memo_dnode + ((hash_table_vector_header_count) >>1);
     1342            hashp = hp;
     1343            mark_method = 3;
     1344
     1345
     1346
     1347
     1348
     1349          }
    13371350        }
    13381351      }
Note: See TracChangeset for help on using the changeset viewer.