Make LOOKS_LIKE_{INFO,CLOSURE}_PTR into inline functions, instead of macros
[ghc-hetmet.git] / rts / Sanity.c
index b8bf5d4..3eea3cd 100644 (file)
@@ -247,7 +247,7 @@ checkClosure( StgClosure* p )
 {
     const StgInfoTable *info;
 
-    ASSERT(LOOKS_LIKE_INFO_PTR(p->header.info));
+    ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
 
     p = UNTAG_CLOSURE(p);
     /* Is it a static closure (i.e. in the data segment)? */
@@ -257,7 +257,13 @@ checkClosure( StgClosure* p )
        ASSERT(!closure_STATIC(p));
     }
 
-    info = get_itbl(p);
+    info = p->header.info;
+
+    if (IS_FORWARDING_PTR(info)) {
+        barf("checkClosure: found EVACUATED closure %d", info->type);
+    }
+    info = INFO_PTR_TO_STRUCT(info);
+
     switch (info->type) {
 
     case MVAR_CLEAN:
@@ -506,10 +512,6 @@ checkClosure( StgClosure* p )
         return sizeofW(StgTRecHeader);
       }
       
-      
-    case EVACUATED:
-           barf("checkClosure: found EVACUATED closure %d",
-                info->type);
     default:
            barf("checkClosure (closure type %d)", info->type);
     }
@@ -585,7 +587,7 @@ checkHeap(bdescr *bd)
            
            /* skip over slop */
            while (p < bd->free &&
-                  (*p < 0x1000 || !LOOKS_LIKE_INFO_PTR((void*)*p))) { p++; } 
+                  (*p < 0x1000 || !LOOKS_LIKE_INFO_PTR(*p))) { p++; } 
        }
     }
 }
@@ -626,7 +628,7 @@ checkHeapChunk(StgPtr start, StgPtr end)
   nat size;
 
   for (p=start; p<end; p+=size) {
-    ASSERT(LOOKS_LIKE_INFO_PTR((void*)*p));
+    ASSERT(LOOKS_LIKE_INFO_PTR(*p));
     size = checkClosure((StgClosure *)p);
     /* This is the smallest size of closure that can live in the heap. */
     ASSERT( size >= MIN_PAYLOAD_SIZE + sizeofW(StgHeader) );
@@ -832,7 +834,7 @@ checkStaticObjects ( StgClosure* static_objects )
         StgClosure *indirectee = UNTAG_CLOSURE(((StgIndStatic *)p)->indirectee);
 
        ASSERT(LOOKS_LIKE_CLOSURE_PTR(indirectee));
-       ASSERT(LOOKS_LIKE_INFO_PTR(indirectee->header.info));
+       ASSERT(LOOKS_LIKE_INFO_PTR((StgWord)indirectee->header.info));
        p = *IND_STATIC_LINK((StgClosure *)p);
        break;
       }