summaryrefslogtreecommitdiff
path: root/ghc/compiler/ghci/ByteCodeGen.lhs
diff options
context:
space:
mode:
authorsimonpj <unknown>2003-01-09 16:11:03 +0000
committersimonpj <unknown>2003-01-09 16:11:03 +0000
commit08c4504027dc64558a0f721a7f07be6e9221d120 (patch)
tree3479ba46e60b86d4e97fa0392caf28f3916995b9 /ghc/compiler/ghci/ByteCodeGen.lhs
parent34a7ef9c84fedbbb8d181dd1cfeb8aee5601c206 (diff)
downloadhaskell-08c4504027dc64558a0f721a7f07be6e9221d120.tar.gz
[project @ 2003-01-09 16:11:03 by simonpj]
Wibble
Diffstat (limited to 'ghc/compiler/ghci/ByteCodeGen.lhs')
-rw-r--r--ghc/compiler/ghci/ByteCodeGen.lhs20
1 files changed, 11 insertions, 9 deletions
diff --git a/ghc/compiler/ghci/ByteCodeGen.lhs b/ghc/compiler/ghci/ByteCodeGen.lhs
index 3821b8d0c8..8b3a4fddd8 100644
--- a/ghc/compiler/ghci/ByteCodeGen.lhs
+++ b/ghc/compiler/ghci/ByteCodeGen.lhs
@@ -355,9 +355,10 @@ schemeE d s p (AnnLit literal)
schemeE d s p (AnnLet (AnnNonRec x (_,rhs)) (_,body))
| (AnnVar v, args_r_to_l) <- splitApp rhs,
- Just data_con <- isDataConId_maybe v
+ Just data_con <- isDataConId_maybe v,
+ dataConRepArity data_con == length args_r_to_l
= -- Special case for a non-recursive let whose RHS is a
- -- (guaranteed saturatred) constructor application
+ -- saturatred constructor application.
-- Just allocate the constructor and carry on
mkConAppCode d s p data_con args_r_to_l `thenBc` \ alloc_code ->
schemeE (d+1) s (addToFM p x d) body `thenBc` \ body_code ->
@@ -503,7 +504,7 @@ schemeT d s p app
= generateCCall d s p ccall_spec fn args_r_to_l
-- Case 2: Constructor application
- | Just con <- maybe_dcon,
+ | Just con <- maybe_saturated_dcon,
isUnboxedTupleCon con
= case args_r_to_l of
[arg1,arg2] | isVoidRepAtom arg1 ->
@@ -513,7 +514,7 @@ schemeT d s p app
_other -> unboxedTupleException
-- Case 3: Ordinary data constructor
- | Just con <- maybe_dcon
+ | Just con <- maybe_saturated_dcon
= mkConAppCode d s p con args_r_to_l `thenBc` \ alloc_con ->
returnBc (alloc_con `appOL`
mkSLIDE 1 (d - s) `snocOL`
@@ -543,13 +544,14 @@ schemeT d s p app
-- The function will necessarily be a variable,
-- because we are compiling a tail call
(AnnVar fn, args_r_to_l) = splitApp app
- n_args = length args_r_to_l
- -- only consider this to be a constructor application iff it is
+ -- Only consider this to be a constructor application iff it is
-- saturated. Otherwise, we'll call the constructor wrapper.
- maybe_dcon = case isDataConId_maybe fn of
- Just con | dataConRepArity con == n_args -> Just con
- _ -> Nothing
+ n_args = length args_r_to_l
+ maybe_saturated_dcon
+ = case isDataConId_maybe fn of
+ Just con | dataConRepArity con == n_args -> Just con
+ _ -> Nothing
-- -----------------------------------------------------------------------------
-- Generate code to build a constructor application,