[GHC] #659: Code bloat for instances of empty classes

GHC trac at galois.com
Mon Jan 16 21:29:19 EST 2006


#659: Code bloat for instances of empty classes
-------------------------+--------------------------------------------------
    Reporter:  wolfgang  |        Owner:             
        Type:  bug       |       Status:  new        
    Priority:  normal    |    Milestone:             
   Component:  Compiler  |      Version:  6.4.1      
    Severity:  trivial   |     Keywords:             
          Os:  Multiple  |   Difficulty:  Easy (1 hr)
Architecture:  Multiple  |  
-------------------------+--------------------------------------------------
TcInstDcls has a special case for empty classes that leads to a seemingly
 unnecessary increase in code size. Comments refer to CCallable and
 CReturnable, so I think this is just a leftover; removing it didn't cause
 any crashes for me, but a Wizard who knows the code should have a short
 glance at it first.

 {{{
 Index: ghc/compiler/typecheck/TcInstDcls.lhs
 ===================================================================
 RCS file: /home/cvs/root/fptools/ghc/compiler/typecheck/TcInstDcls.lhs,v
 retrieving revision 1.182
 diff -u -r1.182 TcInstDcls.lhs
 --- ghc/compiler/typecheck/TcInstDcls.lhs       6 Jan 2006 16:30:19 -0000
 1.182
 +++ ghc/compiler/typecheck/TcInstDcls.lhs       17 Jan 2006 02:18:19 -0000
 @@ -395,18 +395,6 @@
                 --      See Note [Inline dfuns] below

         dict_rhs
 -         | null scs_and_meths
 -         =     -- Blatant special case for CCallable, CReturnable
 -               -- If the dictionary is empty then we should never
 -               -- select anything from it, so we make its RHS just
 -               -- emit an error message.  This in turn means that we
 don't
 -               -- mention the constructor, which doesn't exist for
 CCallable, CReturnable
 -               -- Hardly beautiful, but only three extra lines.
 -           nlHsApp (noLoc $ TyApp (nlHsVar rUNTIME_ERROR_ID)
 -                                  [idType this_dict_id])
 -                 (nlHsLit (HsStringPrim (mkFastString msg)))
 -
 -         | otherwise   -- The common case
           = mkHsConApp dict_constr inst_tys' (map HsVar scs_and_meths)
                 -- We don't produce a binding for the dict_constr; instead
 we
                 -- rely on the simplifier to unfold this saturated
 application
 }}}

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


More information about the Glasgow-haskell-bugs mailing list