Changes between Version 13 and Version 14 of LateDmd

Aug 30, 2013 5:10:29 PM (8 months ago)



  • LateDmd

    v13 v14  
    7474=== Main Benefit of Removal === 
    76 The clever .hi scheme caused !CoreLint errors when combined with -flate-dmd-anal. I irresponsibly cannot remember the recipe for this bug. It was triggered in one of three ways: building GHC, running nofib, or running ./validate. 
     76The clever .hi scheme caused !CoreLint errors when combined with -flate-dmd-anal. Trying to build GHC with -flate-dmd-anal on the libraries incurs a panic 
     79ghc-stage1: panic! (the 'impossible' happened) 
     80  (GHC version 7.7.20130830 for x86_64-apple-darwin): 
     81        applyTypeToArgs 
     82    Expression: base:GHC.Real.$weven{v reB} [gid] 
     83                  @ a{tv a13L} [tv] 
     84                  ww_a5VQ{v} [lid] 
     85                  ww_a5VU{v} [lid] 
     86                  ww_a5W7{v} [lid] 
     87                  w_a5VK{v} [lid] 
     88    Type: forall a{tv a2aJ} [tv]. 
     89          base:GHC.Real.Real{tc 2e} a{tv a2aJ} [tv] => 
     90          (a{tv a2aJ} [tv] -> a{tv a2aJ} [tv] -> a{tv a2aJ} [tv]) 
     91          -> a{tv a2aJ} [tv] -> ghc-prim:GHC.Types.Bool{(w) tc 3c} 
     92    Args: [TYPE a{tv a13L} [tv], ww_a5VQ{v} [lid], ww_a5VU{v} [lid], 
     93           ww_a5W7{v} [lid], w_a5VK{v} [lid]] 
     95Please report this as a GHC bug: 
     98The issue here is that the second demand analysis in GHC.Real refines the strictness of GHC.Real.even. 
     101first Str=DmdType <S(SLLLLLLLL),U(U,A,A,U,A,A,A,A,A)> 
     102                  <L,U> 
     104second Str=DmdType <S(S(LS(SLLLLLLL)L)LLLLLLLL), 
     105                    1*U(1*U(U(A,A,A,A,A,A,U), 
     106                            U(U,A,A,A,A,A,A,A), 
     107                            A), 
     108                    A, 
     109                    A, 
     110                    1*C1(C1(U)), 
     111                    A,A,A,A,A)> 
     113                   <L,U>, 
     116Since there are three leaf Us in the first signature, the worker's type takes '''three''' value arguments. But the second strictness for GHC.Real.even is recorded in the .hi file, and it has four leaf Us. So when the importing module regenerates the body of the GHC.Real.even wrapper, it applies the worker to '''four''' value arguments. Boom. 
    78118Similar to -flate-dmd-anal, abandoning the clever .hi scheme lets us safely import code compiled with/without -ffun-to-thunk from a module compiled without/with -ffun-to-thunk. I can explain this one. 
    83123If demand analysis removes all the value arguments from a function f in A.hs and B.hs uses that function, compilation of B.hs will crash. The problem is that the regeneration of the body of f in B will attempt to apply f to a `realWorld#` argument because there is no -ffun-to-thunk flag. However, f no longer accepts any arguments, since it was compiled with -ffun-to-thunk. Boom. 
    85 (The -flate-dmd-anal bug was similar, but more involved.) 
    87125== -flate-dmd-anal ==