Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#659 closed bug (fixed)

Code bloat for instances of empty classes

Reported by: wolfgang Owned by:
Priority: normal Milestone: 6.6
Component: Compiler Version: 6.4.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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
-         | 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

Change History (5)

comment:1 Changed 12 years ago by simonmar

Milestone: 6.6

comment:2 Changed 12 years ago by simonpj

Resolution: fixed
Status: newclosed

Good idea. I'll commit the patch shortly.


comment:3 Changed 9 years ago by simonmar

Architecture: MultipleUnknown/Multiple

comment:4 Changed 9 years ago by simonmar

Operating System: MultipleUnknown/Multiple

comment:5 Changed 8 years ago by simonmar

difficulty: Easy (1 hr)Easy (less than 1 hour)
Note: See TracTickets for help on using tickets.