From: simonpj Date: Fri, 23 Mar 2001 10:46:27 +0000 (+0000) Subject: [project @ 2001-03-23 10:46:27 by simonpj] X-Git-Tag: Approximately_9120_patches~2338 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=644c1be9b359ac664fb54a6f0aef6e740729d07e;p=ghc-hetmet.git [project @ 2001-03-23 10:46:27 by simonpj] ----------------------------------- Correct size calculations for INLINE notes ----------------------------------- Amazingly, CoreUnfold.size_up wasn't treating an InlineMe note as small. (InlineMe was only dealt with at top level.) As the comment now says: -- This can be important. If you have an instance decl like this: -- instance Foo a => Foo [a] where -- {-# INLINE op1, op2 #-} -- op1 = ... -- op2 = ... -- then we'll get a dfun which is a pair of two INLINE lambdas This fixes a problem Manuel encountered. --- diff --git a/ghc/compiler/coreSyn/CoreUnfold.lhs b/ghc/compiler/coreSyn/CoreUnfold.lhs index cf9107b..7db6f2d 100644 --- a/ghc/compiler/coreSyn/CoreUnfold.lhs +++ b/ghc/compiler/coreSyn/CoreUnfold.lhs @@ -188,7 +188,15 @@ sizeExpr bOMB_OUT_SIZE top_args expr size_up (Type t) = sizeZero -- Types cost nothing size_up (Var v) = sizeOne - size_up (Note _ body) = size_up body -- Notes cost nothing + size_up (Note InlineMe body) = sizeOne -- Inline notes make it look very small + -- This can be important. If you have an instance decl like this: + -- instance Foo a => Foo [a] where + -- {-# INLINE op1, op2 #-} + -- op1 = ... + -- op2 = ... + -- then we'll get a dfun which is a pair of two INLINE lambdas + + size_up (Note _ body) = size_up body -- Other notes cost nothing size_up (App fun (Type t)) = size_up fun size_up (App fun arg) = size_up_app fun [arg]