diff options
author | sof <unknown> | 2001-10-25 02:13:16 +0000 |
---|---|---|
committer | sof <unknown> | 2001-10-25 02:13:16 +0000 |
commit | 9e93335020e64a811dbbb223e1727c76933a93ae (patch) | |
tree | aa4607430cb048b7bf00cc9ab00620494b41f0e6 /ghc/compiler/javaGen/JavaGen.lhs | |
parent | dccacbf9dd82d82657f4885a91d3deb57ce22f53 (diff) | |
download | haskell-9e93335020e64a811dbbb223e1727c76933a93ae.tar.gz |
[project @ 2001-10-25 02:13:10 by sof]
- Pet peeve removal / code tidyup, replaced various sub-optimal
uses of 'length' with something a bit better, i.e., replaced
the following patterns
* length as `cmpOp` length bs
* length as `cmpOp` val -- incl. uses where val == 1 and val == 0
* {take,drop,splitAt} (length as) bs
* length [ () | pat <- as ]
with uses of misc Util functions.
I'd be surprised if there's a noticeable reduction in running
times as a result of these changes, but every little bit helps.
[ The changes have been tested wrt testsuite/ - I'm seeing a couple
of unexpected breakages coming from CorePrep, but I'm currently
assuming that these are due to other recent changes. ]
- compMan/CompManager.lhs: restored 4.08 compilability + some code
cleanup.
None of these changes are HEADworthy.
Diffstat (limited to 'ghc/compiler/javaGen/JavaGen.lhs')
-rw-r--r-- | ghc/compiler/javaGen/JavaGen.lhs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/ghc/compiler/javaGen/JavaGen.lhs b/ghc/compiler/javaGen/JavaGen.lhs index 58d8808b3e..9b5bcba532 100644 --- a/ghc/compiler/javaGen/JavaGen.lhs +++ b/ghc/compiler/javaGen/JavaGen.lhs @@ -66,6 +66,7 @@ import Outputable import Maybe import PrimOp +import Util ( lengthIs ) #include "HsVersions.h" @@ -266,7 +267,7 @@ javaCase :: (Expr -> Statement) -> CoreExpr -> Id -> [CoreAlt] -> [Statement] -- If we've got the wrong one, this is _|_, and the -- casting will catch this with an exception. -javaCase r e x [(DataAlt d,bs,rhs)] | length bs > 0 +javaCase r e x [(DataAlt d,bs,rhs)] | not (null bs) = java_expr PushExpr e ++ [ var [Final] (javaName x) (whnf primRep (vmPOP (primRepToType primRep))) ] ++ @@ -420,7 +421,7 @@ javaApp r (CoreSyn.App f a) as | otherwise = javaApp r f as javaApp r (CoreSyn.Var f) as = case isDataConId_maybe f of { - Just dc | length as == dataConRepArity dc + Just dc | as `lengthIs` dataConRepArity dc -- NOTE: Saturated constructors never returning a primitive at this point -- -- We push the arguments backwards, because we are using |