[commit: ghc] master: BlockAlloc.c: reuse tail_of function (40a76c9)

git at git.haskell.org git at git.haskell.org
Fri May 11 07:24:31 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/40a76c99624ae82e960bad0f1c832ddec4aece16/ghc

>---------------------------------------------------------------

commit 40a76c99624ae82e960bad0f1c832ddec4aece16
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date:   Fri May 11 10:24:00 2018 +0300

    BlockAlloc.c: reuse tail_of function


>---------------------------------------------------------------

40a76c99624ae82e960bad0f1c832ddec4aece16
 rts/sm/BlockAlloc.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/rts/sm/BlockAlloc.c b/rts/sm/BlockAlloc.c
index 2a02ecc..bbb4f8a 100644
--- a/rts/sm/BlockAlloc.c
+++ b/rts/sm/BlockAlloc.c
@@ -210,6 +210,12 @@ void recordFreedBlocks(uint32_t node, uint32_t n)
    Allocation
    -------------------------------------------------------------------------- */
 
+STATIC_INLINE bdescr *
+tail_of (bdescr *bd)
+{
+    return bd + bd->blocks - 1;
+}
+
 STATIC_INLINE void
 initGroup(bdescr *head)
 {
@@ -223,7 +229,7 @@ initGroup(bdescr *head)
   // mblocks don't have bdescrs; freeing these is handled in a
   // different way by free_mblock_group().
   if (head->blocks > 1 && head->blocks <= BLOCKS_PER_MBLOCK) {
-      bdescr *last = head + head->blocks-1;
+      bdescr *last = tail_of(head);
       last->blocks = 0;
       last->link = head;
   }
@@ -285,13 +291,6 @@ free_list_insert (uint32_t node, bdescr *bd)
     dbl_link_onto(bd, &free_list[node][ln]);
 }
 
-
-STATIC_INLINE bdescr *
-tail_of (bdescr *bd)
-{
-    return bd + bd->blocks - 1;
-}
-
 // After splitting a group, the last block of each group must have a
 // tail that points to the head block, to keep our invariants for
 // coalescing.



More information about the ghc-commits mailing list