Opened 8 years ago

Closed 8 years ago

Last modified 4 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: Difficulty: Easy (less than 1 hour)
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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

Change History (5)

comment:1 Changed 8 years ago by simonmar

  • Milestone set to 6.6

comment:2 Changed 8 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed

Good idea. I'll commit the patch shortly.

Simon

comment:3 Changed 6 years ago by simonmar

  • Architecture changed from Multiple to Unknown/Multiple

comment:4 Changed 6 years ago by simonmar

  • Operating System changed from Multiple to Unknown/Multiple

comment:5 Changed 4 years ago by simonmar

  • Difficulty changed from Easy (1 hr) to Easy (less than 1 hour)
Note: See TracTickets for help on using tickets.