[Openmcl-cvs-notifications] r14723 - in /trunk/source/lisp-kernel: arm-gc.c ppc-gc.c x86-gc.c

gb at clozure.com gb at clozure.com
Thu Apr 21 16:20:04 CDT 2011


Author: gb
Date: Thu Apr 21 16:20:04 2011
New Revision: 14723

Log:
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.



Modified:
    trunk/source/lisp-kernel/arm-gc.c
    trunk/source/lisp-kernel/ppc-gc.c
    trunk/source/lisp-kernel/x86-gc.c

Modified: trunk/source/lisp-kernel/arm-gc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/arm-gc.c (original)
+++ trunk/source/lisp-kernel/arm-gc.c Thu Apr 21 16:20:04 2011
@@ -885,11 +885,14 @@
         if (hashp) Bug(NULL, "header inside hash vector?");
         hash_table_vector_header *hp =3D (hash_table_vector_header *)(p - =
2);
         if (hp->flags & nhash_weak_mask) {
-          /* If header_count is odd, this cuts off the last header field */
-          /* That case is handled specially above */
-          hash_dnode_limit =3D memo_dnode + ((hash_table_vector_header_cou=
nt) >>1);
-          hashp =3D hp;
-          mark_method =3D 3;
+          /* Workaround for ticket:817 */
+          if (!(hp->flags & nhash_weak_value_mask)) {
+            /* If header_count is odd, this cuts off the last header field=
 */
+            /* That case is handled specially above */
+            hash_dnode_limit =3D memo_dnode + ((hash_table_vector_header_c=
ount) >>1);
+            hashp =3D hp;
+            mark_method =3D 3;
+          }
         }
       }
 =


Modified: trunk/source/lisp-kernel/ppc-gc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/ppc-gc.c (original)
+++ trunk/source/lisp-kernel/ppc-gc.c Thu Apr 21 16:20:04 2011
@@ -927,7 +927,7 @@
 =

      Some headers are "interesting", to the forwarder if not to us. =

 =

-     */
+  */
 =

   /*
     We need to ensure that there are no bits set at or beyond
@@ -935,7 +935,7 @@
     tenures/untenures things.)  We find bits by grabbing a fullword at
     a time and doing a cntlzw instruction; and don't want to have to
     check for (< memo_dnode num_memo_dnodes) in the loop.
-    */
+  */
 =

   {
     natural =

@@ -1002,12 +1002,15 @@
       if (header_subtag(x1) =3D=3D subtag_hash_vector) {
         if (hashp) Bug(NULL, "header inside hash vector?");
         hash_table_vector_header *hp =3D (hash_table_vector_header *)(p - =
2);
-        if (hp->flags & nhash_weak_mask) {
-          /* If header_count is odd, this cuts off the last header field */
-          /* That case is handled specially above */
-          hash_dnode_limit =3D memo_dnode + ((hash_table_vector_header_cou=
nt) >>1);
-          hashp =3D hp;
-          mark_method =3D 3;
+        /* Workaround for ticket:817 */
+        if (!(hp->flags & nhash_weak_value_mask)) {
+          if (hp->flags & nhash_weak_mask) {
+            /* If header_count is odd, this cuts off the last header field=
 */
+            /* That case is handled specially above */
+            hash_dnode_limit =3D memo_dnode + ((hash_table_vector_header_c=
ount) >>1);
+            hashp =3D hp;
+            mark_method =3D 3;
+          }
         }
       }
 =


Modified: trunk/source/lisp-kernel/x86-gc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/x86-gc.c (original)
+++ trunk/source/lisp-kernel/x86-gc.c Thu Apr 21 16:20:04 2011
@@ -1252,7 +1252,7 @@
 =

      Some headers are "interesting", to the forwarder if not to us. =

 =

-     */
+  */
 =

   /*
     We need to ensure that there are no bits set at or beyond
@@ -1260,7 +1260,7 @@
     tenures/untenures things.)  We find bits by grabbing a fullword at
     a time and doing a cntlzw instruction; and don't want to have to
     check for (< memo_dnode num_memo_dnodes) in the loop.
-    */
+  */
 =

   {
     natural =

@@ -1296,6 +1296,7 @@
       x1 =3D *p++;
       x2 =3D *p++;
       bits &=3D ~(BIT0_MASK >> bitidx);
+
 =

       if (hashp) {
         Boolean force_x1 =3D false;
@@ -1328,11 +1329,23 @@
         if (hashp) Bug(NULL, "header inside hash vector?");
         hash_table_vector_header *hp =3D (hash_table_vector_header *)(p - =
2);
         if (hp->flags & nhash_weak_mask) {
-          /* If header_count is odd, this cuts off the last header field */
-          /* That case is handled specially above */
-          hash_dnode_limit =3D memo_dnode + ((hash_table_vector_header_cou=
nt) >>1);
-          hashp =3D hp;
-          mark_method =3D 3;
+          /* Work around the issue that seems to cause ticket:817,
+             which is that tenured hash vectors that are weak on value
+             aren't always maintained on GCweakvll.  If they aren't and
+             we process them weakly here, nothing will delete the unrefere=
nced
+             elements. */
+          if (!(hp->flags & nhash_weak_value_mask)) {
+            /* If header_count is odd, this cuts off the last header field=
 */
+            /* That case is handled specially above */
+            hash_dnode_limit =3D memo_dnode + ((hash_table_vector_header_c=
ount) >>1);
+            hashp =3D hp;
+            mark_method =3D 3;
+
+
+
+
+
+          }
         }
       }
 =




More information about the Openmcl-cvs-notifications mailing list