[commit: ghc] wip/nonmoving-gc: rts/GC: Add an obvious assertion during block initialization (f31c198)

git at git.haskell.org git at git.haskell.org
Wed Feb 6 14:09:37 UTC 2019


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

On branch  : wip/nonmoving-gc
Link       : http://ghc.haskell.org/trac/ghc/changeset/f31c198d76b9df529f462e83c16ef33612e7bff0/ghc

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

commit f31c198d76b9df529f462e83c16ef33612e7bff0
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.


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

f31c198d76b9df529f462e83c16ef33612e7bff0
 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