Remove static flag opt_RuntimeTypes (has not been used in years)
authorsimonpj@microsoft.com <unknown>
Tue, 22 Apr 2008 11:48:48 +0000 (11:48 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 22 Apr 2008 11:48:48 +0000 (11:48 +0000)
compiler/coreSyn/CoreSyn.lhs
compiler/coreSyn/CoreUtils.lhs
compiler/main/StaticFlags.hs
compiler/stgSyn/CoreToStg.lhs
compiler/stgSyn/StgSyn.lhs

index 9b67515..86a7e9d 100644 (file)
@@ -48,7 +48,6 @@ module CoreSyn (
 
 #include "HsVersions.h"
 
 
 #include "HsVersions.h"
 
-import StaticFlags
 import CostCentre
 import Var
 import Type
 import CostCentre
 import Var
 import Type
@@ -591,23 +590,18 @@ coreExprCc _                   = noCostCentre
 %*                                                                     *
 %************************************************************************
 
 %*                                                                     *
 %************************************************************************
 
+At one time we optionally carried type arguments through to runtime.
 @isRuntimeVar v@ returns if (Lam v _) really becomes a lambda at runtime,
 i.e. if type applications are actual lambdas because types are kept around
 @isRuntimeVar v@ returns if (Lam v _) really becomes a lambda at runtime,
 i.e. if type applications are actual lambdas because types are kept around
-at runtime.  
-
-Similarly isRuntimeArg.  
+at runtime.  Similarly isRuntimeArg.  
 
 \begin{code}
 isRuntimeVar :: Var -> Bool
 
 \begin{code}
 isRuntimeVar :: Var -> Bool
-isRuntimeVar | opt_RuntimeTypes = \_ -> True
-            | otherwise        = \v -> isId v
+isRuntimeVar = isId 
 
 isRuntimeArg :: CoreExpr -> Bool
 
 isRuntimeArg :: CoreExpr -> Bool
-isRuntimeArg | opt_RuntimeTypes = \_ -> True
-            | otherwise        = \e -> isValArg e
-\end{code}
+isRuntimeArg = isValArg
 
 
-\begin{code}
 isValArg :: Expr b -> Bool
 isValArg (Type _) = False
 isValArg _        = True
 isValArg :: Expr b -> Bool
 isValArg (Type _) = False
 isValArg _        = True
index c8d6611..2599f4a 100644 (file)
@@ -1550,9 +1550,6 @@ rhsIsStatic :: PackageId -> CoreExpr -> Bool
 --        dynamic
 -- 
 --    c) don't look through unfolding of f in (f x).
 --        dynamic
 -- 
 --    c) don't look through unfolding of f in (f x).
---
--- When opt_RuntimeTypes is on, we keep type lambdas and treat
--- them as making the RHS re-entrant (non-updatable).
 
 rhsIsStatic _this_pkg rhs = is_static False rhs
   where
 
 rhsIsStatic _this_pkg rhs = is_static False rhs
   where
index a2362d9..41ff667 100644 (file)
@@ -36,7 +36,6 @@ module StaticFlags (
        opt_DictsStrict,
        opt_IrrefutableTuples,
        opt_Parallel,
        opt_DictsStrict,
        opt_IrrefutableTuples,
        opt_Parallel,
-       opt_RuntimeTypes,
 
        -- optimisation opts
        opt_NoMethodSharing, 
 
        -- optimisation opts
        opt_NoMethodSharing, 
@@ -334,8 +333,6 @@ opt_HistorySize :: Int
 opt_HistorySize                        = lookup_def_int "-fhistory-size" 20
 opt_OmitBlackHoling :: Bool
 opt_OmitBlackHoling            = lookUp  FSLIT("-dno-black-holing")
 opt_HistorySize                        = lookup_def_int "-fhistory-size" 20
 opt_OmitBlackHoling :: Bool
 opt_OmitBlackHoling            = lookUp  FSLIT("-dno-black-holing")
-opt_RuntimeTypes :: Bool
-opt_RuntimeTypes               = lookUp  FSLIT("-fruntime-types")
 
 -- Simplifier switches
 opt_SimplNoPreInlining :: Bool
 
 -- Simplifier switches
 opt_SimplNoPreInlining :: Bool
index 4956ccc..747ad40 100644 (file)
@@ -35,7 +35,6 @@ import Maybes         ( maybeToBool )
 import Name            ( getOccName, isExternalName, nameOccName )
 import OccName         ( occNameString, occNameFS )
 import BasicTypes       ( Arity )
 import Name            ( getOccName, isExternalName, nameOccName )
 import OccName         ( occNameString, occNameFS )
 import BasicTypes       ( Arity )
-import StaticFlags     ( opt_RuntimeTypes )
 import Module
 import Outputable
 import MonadUtils
 import Module
 import Outputable
 import MonadUtils
@@ -463,14 +462,10 @@ coreToStgApp maybe_thunk_body f args = do
     let
        n_val_args       = valArgCount args
        not_letrec_bound = not (isLetBound how_bound)
     let
        n_val_args       = valArgCount args
        not_letrec_bound = not (isLetBound how_bound)
-       fun_fvs          
-          = let fvs = singletonFVInfo f how_bound fun_occ in
+       fun_fvs = singletonFVInfo f how_bound fun_occ
             -- e.g. (f :: a -> int) (x :: a) 
             -- Here the free variables are "f", "x" AND the type variable "a"
             -- coreToStgArgs will deal with the arguments recursively
             -- e.g. (f :: a -> int) (x :: a) 
             -- Here the free variables are "f", "x" AND the type variable "a"
             -- coreToStgArgs will deal with the arguments recursively
-            if opt_RuntimeTypes then
-             fvs `unionFVInfo` tyvarFVInfo (tyVarsOfType (idType f))
-           else fvs
 
        -- Mostly, the arity info of a function is in the fn's IdInfo
        -- But new bindings introduced by CoreSat may not have no
 
        -- Mostly, the arity info of a function is in the fn's IdInfo
        -- But new bindings introduced by CoreSat may not have no
@@ -537,10 +532,7 @@ coreToStgArgs []
 
 coreToStgArgs (Type ty : args) = do     -- Type argument
     (args', fvs) <- coreToStgArgs args
 
 coreToStgArgs (Type ty : args) = do     -- Type argument
     (args', fvs) <- coreToStgArgs args
-    if opt_RuntimeTypes then
-        return (StgTypeArg ty : args', fvs `unionFVInfo` tyvarFVInfo (tyVarsOfType ty))
-     else
-        return (args', fvs)
+    return (args', fvs)
 
 coreToStgArgs (arg : args) = do         -- Non-type argument
     (stg_args, args_fvs) <- coreToStgArgs args
 
 coreToStgArgs (arg : args) = do         -- Non-type argument
     (stg_args, args_fvs) <- coreToStgArgs args
@@ -1008,10 +1000,12 @@ singletonFVInfo id ImportBound info
 singletonFVInfo id how_bound info  = unitVarEnv id (id, how_bound, info)
 
 tyvarFVInfo :: TyVarSet -> FreeVarsInfo
 singletonFVInfo id how_bound info  = unitVarEnv id (id, how_bound, info)
 
 tyvarFVInfo :: TyVarSet -> FreeVarsInfo
-tyvarFVInfo tvs = foldVarSet add emptyFVInfo tvs
-        where
-         add tv fvs = extendVarEnv fvs tv (tv, LambdaBound, noBinderInfo)
-               -- Type variables must be lambda-bound
+tyvarFVInfo tvs = emptyFVInfo  -- Type variables are not recorded
+-- Old code recorded free tyvars for when we supported runtime types:
+--    foldVarSet add emptyFVInfo tvs
+--        where
+--       add tv fvs = extendVarEnv fvs tv (tv, LambdaBound, noBinderInfo)
+--             -- Type variables must be lambda-bound
 
 unionFVInfo :: FreeVarsInfo -> FreeVarsInfo -> FreeVarsInfo
 unionFVInfo fv1 fv2 = plusVarEnv_C plusFVInfo fv1 fv2
 
 unionFVInfo :: FreeVarsInfo -> FreeVarsInfo -> FreeVarsInfo
 unionFVInfo fv1 fv2 = plusVarEnv_C plusFVInfo fv1 fv2
@@ -1023,10 +1017,7 @@ minusFVBinders :: [Id] -> FreeVarsInfo -> FreeVarsInfo
 minusFVBinders vs fv = foldr minusFVBinder fv vs
 
 minusFVBinder :: Id -> FreeVarsInfo -> FreeVarsInfo
 minusFVBinders vs fv = foldr minusFVBinder fv vs
 
 minusFVBinder :: Id -> FreeVarsInfo -> FreeVarsInfo
-minusFVBinder v fv | isId v && opt_RuntimeTypes
-                  = (fv `delVarEnv` v) `unionFVInfo` 
-                    tyvarFVInfo (tyVarsOfType (idType v))
-                  | otherwise = fv `delVarEnv` v
+minusFVBinder v fv = fv `delVarEnv` v
        -- When removing a binder, remember to add its type variables
        -- c.f. CoreFVs.delBinderFV
 
        -- When removing a binder, remember to add its type variables
        -- c.f. CoreFVs.delBinderFV
 
@@ -1043,10 +1034,11 @@ lookupFVInfo fvs id
                        Just (_,_,info) -> info
 
 allFreeIds :: FreeVarsInfo -> [(Id,HowBound)]  -- Both top level and non-top-level Ids
                        Just (_,_,info) -> info
 
 allFreeIds :: FreeVarsInfo -> [(Id,HowBound)]  -- Both top level and non-top-level Ids
-allFreeIds fvs = [(id,how_bound) | (id,how_bound,_) <- varEnvElts fvs, isId id]
+allFreeIds fvs = ASSERT( all (isId . fst) ids ) ids
+      where
+       ids = [(id,how_bound) | (id,how_bound,_) <- varEnvElts fvs]
 
 -- Non-top-level things only, both type variables and ids
 
 -- Non-top-level things only, both type variables and ids
--- (type variables only if opt_RuntimeTypes)
 getFVs :: FreeVarsInfo -> [Var]        
 getFVs fvs = [id | (id, how_bound, _) <- varEnvElts fvs, 
                    not (topLevelBound how_bound) ]
 getFVs :: FreeVarsInfo -> [Var]        
 getFVs fvs = [id | (id, how_bound, _) <- varEnvElts fvs, 
                    not (topLevelBound how_bound) ]
@@ -1072,9 +1064,7 @@ check_eq_li li1     li2           = False
 Misc.
 \begin{code}
 filterStgBinders :: [Var] -> [Var]
 Misc.
 \begin{code}
 filterStgBinders :: [Var] -> [Var]
-filterStgBinders bndrs
-  | opt_RuntimeTypes = bndrs
-  | otherwise       = filter isId bndrs
+filterStgBinders bndrs = filter isId bndrs
 \end{code}
 
 
 \end{code}
 
 
index 42bcabb..2fc36a1 100644 (file)
@@ -59,7 +59,6 @@ import CoreSyn                ( AltCon )
 import PprCore         ( {- instances -} )
 import PrimOp          ( PrimOp )
 import Outputable
 import PprCore         ( {- instances -} )
 import PrimOp          ( PrimOp )
 import Outputable
-import Util             ( count )
 import Type             ( Type )
 import TyCon            ( TyCon )
 import UniqSet
 import Type             ( Type )
 import TyCon            ( TyCon )
 import UniqSet
@@ -418,10 +417,9 @@ The second flavour of right-hand-side is for constructors (simple but important)
 
 \begin{code}
 stgRhsArity :: StgRhs -> Int
 
 \begin{code}
 stgRhsArity :: StgRhs -> Int
-stgRhsArity (StgRhsClosure _ _ _ _ _ bndrs _) = count isId bndrs
-  -- The arity never includes type parameters, so
-  -- when keeping type arguments and binders in the Stg syntax 
-  -- (opt_RuntimeTypes) we have to fliter out the type binders.
+stgRhsArity (StgRhsClosure _ _ _ _ _ bndrs _) 
+  = ASSERT( all isId bndrs ) length bndrs
+  -- The arity never includes type parameters, but they should have gone by now
 stgRhsArity (StgRhsCon _ _ _) = 0
 \end{code}
 
 stgRhsArity (StgRhsCon _ _ _) = 0
 \end{code}