rts: Fix "ASSERT ("s
authorBen Gamari <bgamari.foss@gmail.com>
Sun, 23 Apr 2017 14:00:19 +0000 (10:00 -0400)
committerBen Gamari <ben@smart-cactus.org>
Sun, 23 Apr 2017 15:05:48 +0000 (11:05 -0400)
Reviewers: austin, erikd, simonmar

Reviewed By: erikd

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3486

rts/Compact.cmm
rts/sm/CNF.c
rts/sm/CNF.h
rts/sm/Sanity.c

index 0b98f39..5290d95 100644 (file)
@@ -358,7 +358,7 @@ stg_compactGetFirstBlockzh ( P_ str )
     W_ size;
 
     block = str - SIZEOF_StgCompactNFDataBlock::W_;
-    ASSERT (StgCompactNFDataBlock_owner(block) == str);
+    ASSERT(StgCompactNFDataBlock_owner(block) == str);
 
     // We have to save Hp back to the nursery, otherwise the size will
     // be wrong.
@@ -367,7 +367,7 @@ stg_compactGetFirstBlockzh ( P_ str )
 
     bd = Bdescr(str);
     size = bdescr_free(bd) - bdescr_start(bd);
-    ASSERT (size <= TO_W_(bdescr_blocks(bd)) * BLOCK_SIZE);
+    ASSERT(size <= TO_W_(bdescr_blocks(bd)) * BLOCK_SIZE);
 
     return (block, size);
 }
@@ -396,12 +396,12 @@ stg_compactGetNextBlockzh ( P_ str, W_ block )
         return (0::W_, 0::W_);
     }
 
-    ASSERT (StgCompactNFDataBlock_owner(next_block) == str ||
+    ASSERT(StgCompactNFDataBlock_owner(next_block) == str ||
             StgCompactNFDataBlock_owner(next_block) == NULL);
 
     bd = Bdescr(next_block);
     size = bdescr_free(bd) - bdescr_start(bd);
-    ASSERT (size <= TO_W_(bdescr_blocks(bd)) * BLOCK_SIZE);
+    ASSERT(size <= TO_W_(bdescr_blocks(bd)) * BLOCK_SIZE);
 
     return (next_block, size);
 }
index ed9460e..b81fd2b 100644 (file)
@@ -203,8 +203,8 @@ compactAllocateBlockInternal(Capability            *cap,
     block = allocGroup(n_blocks);
     switch (operation) {
     case ALLOCATE_NEW:
-        ASSERT (first == NULL);
-        ASSERT (g == g0);
+        ASSERT(first == NULL);
+        ASSERT(g == g0);
         dbl_link_onto(block, &g0->compact_objects);
         g->n_compact_blocks += block->blocks;
         g->n_new_large_words += aligned_size / sizeof(StgWord);
@@ -214,8 +214,8 @@ compactAllocateBlockInternal(Capability            *cap,
         dbl_link_onto(block, &g0->compact_blocks_in_import);
         /* fallthrough */
     case ALLOCATE_IMPORT_APPEND:
-        ASSERT (first == NULL);
-        ASSERT (g == g0);
+        ASSERT(first == NULL);
+        ASSERT(g == g0);
         g->n_compact_blocks_in_import += block->blocks;
         g->n_new_large_words += aligned_size / sizeof(StgWord);
         break;
@@ -307,7 +307,7 @@ countCompactBlocks(bdescr *outer)
         block = (StgCompactNFDataBlock*)(outer->start);
         do {
             inner = Bdescr((P_)block);
-            ASSERT (inner->flags & BF_COMPACT);
+            ASSERT(inner->flags & BF_COMPACT);
 
             count += inner->blocks;
             block = block->next;
@@ -335,7 +335,7 @@ countAllocdCompactBlocks(bdescr *outer)
         block = (StgCompactNFDataBlock*)(outer->start);
         do {
             inner = Bdescr((P_)block);
-            ASSERT (inner->flags & BF_COMPACT);
+            ASSERT(inner->flags & BF_COMPACT);
 
             count += inner->blocks;
             // See BlockAlloc.c:countAllocdBlocks()
@@ -407,13 +407,13 @@ compactAppendBlock (Capability       *cap,
     block->owner = str;
     block->next = NULL;
 
-    ASSERT (str->last->next == NULL);
+    ASSERT(str->last->next == NULL);
     str->last->next = block;
     str->last = block;
 
     bd = Bdescr((P_)block);
     bd->free = (StgPtr)((W_)block + sizeof(StgCompactNFDataBlock));
-    ASSERT (bd->free == (StgPtr)block + sizeofW(StgCompactNFDataBlock));
+    ASSERT(bd->free == (StgPtr)block + sizeofW(StgCompactNFDataBlock));
 
     str->totalW += bd->blocks * BLOCK_SIZE_W;
 
@@ -920,7 +920,7 @@ fixup_block(StgCompactNFDataBlock *block, StgWord *fixup_table, uint32_t count)
     bd = Bdescr((P_)block);
     p = bd->start + sizeofW(StgCompactNFDataBlock);
     while (p < bd->free) {
-        ASSERT (LOOKS_LIKE_CLOSURE_PTR(p));
+        ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
         info = get_itbl((StgClosure*)p);
 
         switch (info->type) {
@@ -1163,8 +1163,8 @@ compactFixupPointers(StgCompactNFData *str,
     total_blocks = str->totalW / BLOCK_SIZE_W;
 
     ACQUIRE_SM_LOCK;
-    ASSERT (bd->gen == g0);
-    ASSERT (g0->n_compact_blocks_in_import >= total_blocks);
+    ASSERT(bd->gen == g0);
+    ASSERT(g0->n_compact_blocks_in_import >= total_blocks);
     g0->n_compact_blocks_in_import -= total_blocks;
     g0->n_compact_blocks += total_blocks;
     dbl_link_remove(bd, &g0->compact_blocks_in_import);
index a01c153..c4655dc 100644 (file)
@@ -48,14 +48,14 @@ INLINE_HEADER StgCompactNFDataBlock *objectGetCompactBlock (StgClosure *closure)
 
     object_block = Bdescr((StgPtr)closure);
 
-    ASSERT ((object_block->flags & BF_COMPACT) != 0);
+    ASSERT((object_block->flags & BF_COMPACT) != 0);
 
     if (object_block->blocks == 0)
         head_block = object_block->link;
     else
         head_block = object_block;
 
-    ASSERT ((head_block->flags & BF_COMPACT) != 0);
+    ASSERT((head_block->flags & BF_COMPACT) != 0);
 
     return (StgCompactNFDataBlock*)(head_block->start);
 }
index 625b12e..2b91540 100644 (file)
@@ -484,22 +484,22 @@ checkCompactObjects(bdescr *bd)
         StgCompactNFData *str;
         StgWord totalW;
 
-        ASSERT (bd->flags & BF_COMPACT);
+        ASSERT(bd->flags & BF_COMPACT);
 
         block = (StgCompactNFDataBlock*)bd->start;
         str = block->owner;
-        ASSERT ((W_)str == (W_)block + sizeof(StgCompactNFDataBlock));
+        ASSERT((W_)str == (W_)block + sizeof(StgCompactNFDataBlock));
 
         totalW = 0;
         for ( ; block ; block = block->next) {
             last = block;
-            ASSERT (block->owner == str);
+            ASSERT(block->owner == str);
 
             totalW += Bdescr((P_)block)->blocks * BLOCK_SIZE_W;
         }
 
-        ASSERT (str->totalW == totalW);
-        ASSERT (str->last == last);
+        ASSERT(str->totalW == totalW);
+        ASSERT(str->last == last);
     }
 }