[commit: ghc] master: Fix offset calculation in __stg_gc_fun (9180df1)

git at git.haskell.org git at git.haskell.org
Mon Jul 6 14:39:39 UTC 2015


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/9180df19dd938901791b84ef7f260f7e2f1f894f/ghc

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

commit 9180df19dd938901791b84ef7f260f7e2f1f894f
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Mon Jul 6 14:09:50 2015 +0100

    Fix offset calculation in __stg_gc_fun
    
    Summary:
    We were not treating the offset as a signed field in this rare case,
    so it would blow up if the offset was negative.
    
    Test Plan: Looked at the assembly
    
    Reviewers: austin, bgamari, rwbarton
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1042


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

9180df19dd938901791b84ef7f260f7e2f1f894f
 rts/HeapStackCheck.cmm                   | 5 +++--
 utils/deriveConstants/DeriveConstants.hs | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/rts/HeapStackCheck.cmm b/rts/HeapStackCheck.cmm
index a1e18ca..9430a09 100644
--- a/rts/HeapStackCheck.cmm
+++ b/rts/HeapStackCheck.cmm
@@ -405,8 +405,9 @@ __stg_gc_fun /* explicit stack */
         if (type == ARG_GEN_BIG) {
 #ifdef TABLES_NEXT_TO_CODE
             // bitmap field holds an offset
-            size = StgLargeBitmap_size( StgFunInfoExtra_bitmap(info)
-                                        + %GET_ENTRY(UNTAG(R1)) /* ### */ );
+            size = StgLargeBitmap_size(
+                      TO_W_(StgFunInfoExtraRev_bitmap_offset(info))
+                      + %GET_ENTRY(UNTAG(R1)) /* ### */ );
 #else
             size = StgLargeBitmap_size( StgFunInfoExtra_bitmap(info) );
 #endif
diff --git a/utils/deriveConstants/DeriveConstants.hs b/utils/deriveConstants/DeriveConstants.hs
index ccf9028..6563550 100644
--- a/utils/deriveConstants/DeriveConstants.hs
+++ b/utils/deriveConstants/DeriveConstants.hs
@@ -568,6 +568,7 @@ wanteds = concat
           ,structField  C    "StgFunInfoExtraRev" "fun_type"
           ,structFieldH Both "StgFunInfoExtraRev" "arity"
           ,structField_ C    "StgFunInfoExtraRev_bitmap" "StgFunInfoExtraRev" "b.bitmap"
+          ,structField_ C    "StgFunInfoExtraRev_bitmap_offset" "StgFunInfoExtraRev" "b.bitmap_offset"
 
           ,structField C "StgLargeBitmap" "size"
           ,fieldOffset C "StgLargeBitmap" "bitmap"



More information about the ghc-commits mailing list