Properly generate info tables for static closures in C--.
authorEdward Z. Yang <ezyang@mit.edu>
Thu, 29 Aug 2013 05:07:07 +0000 (22:07 -0700)
committerEdward Z. Yang <ezyang@cs.stanford.edu>
Thu, 2 Oct 2014 05:26:38 +0000 (22:26 -0700)
Summary:
Previously, we assumed all objects declared in C-- were not-static, even
ones which were CONSTR_NOCAF_STATIC.  This used to be harmless, but now
we need this information to be correct.

Part of remove HEAP_ALLOCED patch set (#8199)

Depends on D264

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Test Plan: validate

Reviewers: simonmar, austin

Subscribers: simonmar, ezyang, carter, thomie

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

GHC Trac Issues: #8199

compiler/cmm/CmmParse.y
compiler/cmm/SMRep.lhs

index 3bd0053..31b1198 100644 (file)
@@ -496,7 +496,8 @@ info    :: { CmmParse (CLabel, Maybe CmmInfoTable, [LocalReg]) }
                           ty  = Constr (fromIntegral $9)  -- Tag
                                        (stringToWord8s $13)
                           rep = mkRTSRep (fromIntegral $11) $
-                                  mkHeapRep dflags False (fromIntegral $5)
+                                  mkHeapRep dflags (fromIntegral $11 == cONSTR_NOCAF_STATIC)
+                                                  (fromIntegral $5)
                                                   (fromIntegral $7) ty
                       return (mkCmmEntryLabel pkg $3,
                               Just $ CmmInfoTable { cit_lbl = mkCmmInfoLabel pkg $3
index 53c9d0a..1d0b9b0 100644 (file)
@@ -41,7 +41,7 @@ module SMRep (
 
         -- ** RTS closure types
         rtsClosureType, rET_SMALL, rET_BIG,
-        aRG_GEN, aRG_GEN_BIG,
+        aRG_GEN, aRG_GEN_BIG, cONSTR_NOCAF_STATIC,
 
         -- ** Arrays
         card, cardRoundUp, cardTableSizeB, cardTableSizeW,
@@ -473,11 +473,12 @@ rtsClosureType rep
       _ -> panic "rtsClosureType"
 
 -- We export these ones
-rET_SMALL, rET_BIG, aRG_GEN, aRG_GEN_BIG :: Int
+rET_SMALL, rET_BIG, aRG_GEN, aRG_GEN_BIG, cONSTR_NOCAF_STATIC :: Int
 rET_SMALL   = RET_SMALL
 rET_BIG     = RET_BIG
 aRG_GEN     = ARG_GEN
 aRG_GEN_BIG = ARG_GEN_BIG
+cONSTR_NOCAF_STATIC = CONSTR_NOCAF_STATIC
 \end{code}
 
 Note [Static NoCaf constructors]