[GHC] #10844: CallStack should not be inlined

GHC ghc-devs at haskell.org
Sat Sep 5 16:21:39 UTC 2015


#10844: CallStack should not be inlined
-------------------------------------+-------------------------------------
              Reporter:  nomeata     |             Owner:
                  Type:  task        |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Compiler    |           Version:  7.10.2
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 The use of CallStack based error messages (since changeset:6740d70d95cb)
 has led to some code size increase, and I believe this needs to be
 improved.

 While investigating the #10788, I was looking at the core produced by that
 code, and I found this in the code:
 {{{
 -- RHS size: {terms: 2, types: 0, coercions: 0}
 Main.main17 :: [Char]
 [GblId,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
          WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 100 0}]
 Main.main17 = unpackCString# "vecto_20t0fI93Jj9LUbaZg6e04I"#

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 Main.main16 :: [Char]
 [GblId,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
          WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 110 0}]
 Main.main16 = unpackCString# "Data.Vector.Primitive.Mutable"#

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 Main.main15 :: [Char]
 [GblId,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
          WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 120 0}]
 Main.main15 = unpackCString# "./Data/Vector/Primitive/Mutable.hs"#

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 Main.main14 :: Int
 [GblId,
  Caf=NoCafRefs,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
          WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
 Main.main14 = I# 97#

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 Main.main13 :: Int
 [GblId,
  Caf=NoCafRefs,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
          WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
 Main.main13 = I# 16#

 -- RHS size: {terms: 2, types: 0, coercions: 0}
 Main.main12 :: Int
 [GblId,
  Caf=NoCafRefs,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
          WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
 Main.main12 = I# 21#

 -- RHS size: {terms: 8, types: 0, coercions: 0}
 Main.main11 :: SrcLoc
 [GblId,
  Str=DmdType,
  Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
          WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 80}]
 Main.main11 =
   SrcLoc
     Main.main17
     Main.main16
     Main.main15
     Main.main14
     Main.main13
     Main.main14
     Main.main12
 }}}

 This is clearly a CallStack from a library, and there is no point in
 copying that into the (every?) use of wherever that came from, as it will
 only increase code size and slow down compilation.

 I don’t know how to fix it, though. Float out CallStacks more
 aggressively? Or is the problem that unfoldings are recorded before that
 can happen?

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


More information about the ghc-tickets mailing list