[commit: ghc] wip/gc/misc-rts, wip/gc/nonmoving-nonconcurrent, wip/gc/preparation: rts/GC: Add an obvious assertion during block initialization (09ab2a9)

git at git.haskell.org git at git.haskell.org
Thu Feb 21 15:11:57 UTC 2019


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

On branches: wip/gc/misc-rts,wip/gc/nonmoving-nonconcurrent,wip/gc/preparation
Link       : http://ghc.haskell.org/trac/ghc/changeset/09ab2a9c50e53a7200a4c8adb8b760eb156136a0/ghc

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

commit 09ab2a9c50e53a7200a4c8adb8b760eb156136a0
Author: Ömer Sinan Ağacan <omer at well-typed.com>
Date:   Tue Feb 5 10:40:29 2019 -0500

    rts/GC: Add an obvious assertion during block initialization
    
    Namely ensure that block descriptors are initialized with valid
    generation numbers.


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

09ab2a9c50e53a7200a4c8adb8b760eb156136a0
 includes/rts/storage/GC.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/includes/rts/storage/GC.h b/includes/rts/storage/GC.h
index 1571975..81850f1 100644
--- a/includes/rts/storage/GC.h
+++ b/includes/rts/storage/GC.h
@@ -240,9 +240,14 @@ void dirty_MUT_VAR(StgRegTable *reg, StgClosure *p);
 /* (needed when dynamic libraries are used). */
 extern bool keepCAFs;
 
+#include "rts/Flags.h"
+
 INLINE_HEADER void initBdescr(bdescr *bd, generation *gen, generation *dest)
 {
     bd->gen     = gen;
     bd->gen_no  = gen->no;
     bd->dest_no = dest->no;
+
+    ASSERT(gen->no < RtsFlags.GcFlags.generations);
+    ASSERT(dest->no < RtsFlags.GcFlags.generations);
 }



More information about the ghc-commits mailing list