[GHC] #15143: Passing an IO value through several functions results in program hanging.

GHC ghc-devs at haskell.org
Sat May 12 07:52:36 UTC 2018


#15143: Passing an IO value through several functions results in program hanging.
-------------------------------------+-------------------------------------
        Reporter:  Burtannia         |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 Reproduced with HEAD as well.

 Only differences in STG between the two versions are:

 {{{
 --- Fast.dump-stg       2018-05-12 10:47:41.827648570 +0300
 +++ Slow.dump-stg       2018-05-12 10:47:47.415771391 +0300
 @@ -1,6 +1,6 @@

  ==================== Pre unarise: ====================
 -2018-05-12 07:47:41.816039401 UTC
 +2018-05-12 07:47:47.404211898 UTC

  Main.$WObsTime [InlPrag=INLINE[2]] :: GHC.Types.Int -> Main.Obs
  [GblId[DataConWrapper],
 @@ -42,7 +42,7 @@
  [GblId,
   Arity=4,
   Caf=NoCafRefs,
 - Str=<S,U><L,U><S,1*U><C(S),1*C1(U(U,U))>,
 + Str=<S,U><L,U><S,1*U><C(S),C(U(U,U))>,
   Unf=OtherCon []] =
      [] \r [sc sg sc1 sc2]
          case sc1 of ds {
 @@ -51,8 +51,8 @@
                  sat [Occ=Once] :: GHC.Types.IO Main.Obs
                  [LclId] =
                      [sc2] \r [s]
 -                        case sc2 s of ds1 {
 -                          (#,#) ipv [Occ=Once] ipv1 [Occ=Once!] ->
 +                        case sc2 s of {
 +                          (#,#) ipv [Occ=Once*] ipv1 [Occ=Once!] ->
                                case ipv1 of {
                                  Main.ObsTime dt [Occ=Once] ->
                                      case +# [dt 1#] of sat {
 @@ -63,7 +63,7 @@
                                                  CCCS Main.ObsTime! [sat];
                                            } in  (#,#) [ipv sat];
                                      };
 -                                Main.ObsTemp _ [Occ=Dead] -> ds1;
 +                                Main.ObsTemp _ [Occ=Dead] -> sc2 ipv;
                                };
                          };
                } in
 }}}

 So I guess `sc2 ipv` is causing the slowness? This is the argument passed
 as `sc2`:

 {{{
 Main.main2
   :: GHC.Prim.State# GHC.Prim.RealWorld
      -> (# GHC.Prim.State# GHC.Prim.RealWorld, Main.Obs #)
 [GblId, Arity=1, Caf=NoCafRefs, Str=<S,U>, Unf=OtherCon []] =
     [] \r [void] Unit# [Main.main3];
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15143#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list