Handle IND_STATIC in isRetainer
authorIan Lynagh <igloo@earth.li>
Fri, 9 Apr 2010 10:42:07 +0000 (10:42 +0000)
committerIan Lynagh <igloo@earth.li>
Fri, 9 Apr 2010 10:42:07 +0000 (10:42 +0000)
IND_STATIC used to be an error, but at the moment it can happen
as isAlive doesn't look through IND_STATIC as it ignores static
closures. See trac #3956 for a program that hit this error.

rts/RetainerProfile.c
rts/sm/GCAux.c

index d14ba06..07a3db4 100644 (file)
@@ -1054,6 +1054,10 @@ isRetainer( StgClosure *c )
     case PAP:
        // indirection
     case IND_PERM:
     case PAP:
        // indirection
     case IND_PERM:
+    // IND_STATIC used to be an error, but at the moment it can happen
+    // as isAlive doesn't look through IND_STATIC as it ignores static
+    // closures. See trac #3956 for a program that hit this error.
+    case IND_STATIC:
     case BLACKHOLE:
        // static objects
     case CONSTR_STATIC:
     case BLACKHOLE:
        // static objects
     case CONSTR_STATIC:
@@ -1069,8 +1073,6 @@ isRetainer( StgClosure *c )
        //
        // Error case
        //
        //
        // Error case
        //
-       // IND_STATIC cannot be *c, *cp, *r in the retainer profiling loop.
-    case IND_STATIC:
        // CONSTR_NOCAF_STATIC
        // cannot be *c, *cp, *r in the retainer profiling loop.
     case CONSTR_NOCAF_STATIC:
        // CONSTR_NOCAF_STATIC
        // cannot be *c, *cp, *r in the retainer profiling loop.
     case CONSTR_NOCAF_STATIC:
index cbbb8b6..f69c81d 100644 (file)
@@ -45,6 +45,10 @@ isAlive(StgClosure *p)
 
     // ignore static closures 
     //
 
     // ignore static closures 
     //
+    // ToDo: This means we never look through IND_STATIC, which means
+    // isRetainer needs to handle the IND_STATIC case rather than
+    // raising an error.
+    //
     // ToDo: for static closures, check the static link field.
     // Problem here is that we sometimes don't set the link field, eg.
     // for static closures with an empty SRT or CONSTR_STATIC_NOCAFs.
     // ToDo: for static closures, check the static link field.
     // Problem here is that we sometimes don't set the link field, eg.
     // for static closures with an empty SRT or CONSTR_STATIC_NOCAFs.