From 17d537ba0af20a72a5bf54f01b463be05935634e Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 31 Mar 2004 15:23:18 +0000 Subject: [PATCH] [project @ 2004-03-31 15:23:16 by simonmar] ClosureInfo.might_be_a_function: this predicate wasn't taking into account abstract types, which might also hide functions underneath. Fixes broken compiler when compiled without -O. --- ghc/compiler/codeGen/CgExpr.lhs | 4 ++-- ghc/compiler/codeGen/ClosureInfo.lhs | 8 +++++--- ghc/compiler/types/TyCon.lhs | 6 +++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ghc/compiler/codeGen/CgExpr.lhs b/ghc/compiler/codeGen/CgExpr.lhs index d8c7b29..903db7e 100644 --- a/ghc/compiler/codeGen/CgExpr.lhs +++ b/ghc/compiler/codeGen/CgExpr.lhs @@ -1,7 +1,7 @@ % % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: CgExpr.lhs,v 1.56 2003/07/02 13:19:28 simonpj Exp $ +% $Id: CgExpr.lhs,v 1.57 2004/03/31 15:23:16 simonmar Exp $ % %******************************************************** %* * @@ -480,7 +480,7 @@ primRetUnboxedTuple op args res_ty temp_uniqs = map mkBuiltinUnique [ n_args .. n_args + length ty_args - 1] temp_amodes = zipWith CTemp temp_uniqs prim_reps in - ccallReturnUnboxedTuple temp_amodes + ccallReturnUnboxedTuple temp_amodes (absC (COpStmt temp_amodes op arg_temps [])) diff --git a/ghc/compiler/codeGen/ClosureInfo.lhs b/ghc/compiler/codeGen/ClosureInfo.lhs index 2de8802..86380ec 100644 --- a/ghc/compiler/codeGen/ClosureInfo.lhs +++ b/ghc/compiler/codeGen/ClosureInfo.lhs @@ -1,7 +1,7 @@ % % (c) The GRASP/AQUA Project, Glasgow University, 1992-1998 % -% $Id: ClosureInfo.lhs,v 1.61 2003/11/17 14:23:31 simonmar Exp $ +% $Id: ClosureInfo.lhs,v 1.62 2004/03/31 15:23:17 simonmar Exp $ % \section[ClosureInfo]{Data structures which describe closures} @@ -76,7 +76,7 @@ import PrimRep import SMRep -- all of it import Type ( isUnLiftedType, Type, repType, splitTyConApp_maybe ) import TcType ( tcSplitSigmaTy ) -import TyCon ( isFunTyCon ) +import TyCon ( isFunTyCon, isAbstractTyCon ) import BasicTypes ( TopLevelFlag(..), isNotTopLevel, isTopLevel, ipNameName ) import Util ( mapAccumL, listLengthCmp, lengthIs ) import FastString @@ -241,7 +241,9 @@ mkClosureLFInfo bndr top fvs upd_flag [] might_be_a_function :: Type -> Bool might_be_a_function ty | Just (tc,_) <- splitTyConApp_maybe (repType ty), - not (isFunTyCon tc) = False + not (isFunTyCon tc) && not (isAbstractTyCon tc) = False + -- don't forget to check for abstract types, which might + -- be functions too. | otherwise = True \end{code} diff --git a/ghc/compiler/types/TyCon.lhs b/ghc/compiler/types/TyCon.lhs index 396df9c..24e94e5 100644 --- a/ghc/compiler/types/TyCon.lhs +++ b/ghc/compiler/types/TyCon.lhs @@ -9,7 +9,7 @@ module TyCon( AlgTyConRhs(..), visibleDataCons, - isFunTyCon, isUnLiftedTyCon, isProductTyCon, + isFunTyCon, isUnLiftedTyCon, isProductTyCon, isAbstractTyCon, isAlgTyCon, isDataTyCon, isSynTyCon, isNewTyCon, isPrimTyCon, isEnumerationTyCon, isTupleTyCon, isUnboxedTupleTyCon, isBoxedTupleTyCon, tupleTyConBoxity, @@ -313,6 +313,10 @@ isFunTyCon :: TyCon -> Bool isFunTyCon (FunTyCon {}) = True isFunTyCon _ = False +isAbstractTyCon :: TyCon -> Bool +isAbstractTyCon (AlgTyCon { algTyConRhs = AbstractTyCon }) = True +isAbstractTyCon _ = False + isPrimTyCon :: TyCon -> Bool isPrimTyCon (PrimTyCon {}) = True isPrimTyCon _ = False -- 1.7.10.4