@@ -271,7 +271,7 @@ eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
271 || (n == sUN "prim__syntactic_eq")
271 || (n == sUN "prim__syntactic_eq")
272 | otherwise = False
272 | otherwise = False
274− getCases cd | simpl = cases_totcheck cd
274+ getCases cd | simpl = cases_compiletime cd
275 | runtime = cases_runtime cd
275 | runtime = cases_runtime cd
276 | otherwise = cases_compiletime cd
276 | otherwise = cases_compiletime cd
@@ -293,7 +293,7 @@ eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
293 [(CaseOp ci _ _ _ _ cd, acc)]
293 [(CaseOp ci _ _ _ _ cd, acc)]
294 | (acc == Public || acc == Hidden) &&
294 | (acc == Public || acc == Hidden) &&
295-- || sUN "assert_total" `elem` stk) &&
295-- || sUN "assert_total" `elem` stk) &&
296− null (fst (cases_totcheck cd)) -> -- unoptimised version
296+ null (fst (cases_compiletime cd)) -> -- unoptimised version
297 let (ns, tree) = getCases cd in
297 let (ns, tree) = getCases cd in
298 if blockSimplify ci n stk
298 if blockSimplify ci n stk
299 then liftM (VP Ref n) (ev ntimes stk top env ty)
299 then liftM (VP Ref n) (ev ntimes stk top env ty)
@@ -755,9 +755,7 @@ data Def = Function !Type !Term
755-- [Name] SC -- Run time cae definitions
755-- [Name] SC -- Run time cae definitions
757data CaseDefs = CaseDefs {
757data CaseDefs = CaseDefs {
758− cases_totcheck :: !([Name], SC),
759 cases_compiletime :: !([Name], SC),
758 cases_compiletime :: !([Name], SC),
760− cases_inlined :: !([Name], SC),
761 cases_runtime :: !([Name], SC)
759 cases_runtime :: !([Name], SC)
763 deriving Generic
761 deriving Generic
@@ -785,11 +783,8 @@ instance Show Def where
785 show (Operator ty _ _) = "Operator: " ++ show ty
783 show (Operator ty _ _) = "Operator: " ++ show ty
786 show (CaseOp (CaseInfo inlc inla inlr) ty atys ps_in ps cd)
784 show (CaseOp (CaseInfo inlc inla inlr) ty atys ps_in ps cd)
787 = let (ns, sc) = cases_compiletime cd
785 = let (ns, sc) = cases_compiletime cd
788− (ns_t, sc_t) = cases_totcheck cd
789 (ns', sc') = cases_runtime cd in
786 (ns', sc') = cases_runtime cd in
790 "Case: " ++ show ty ++ " " ++ show ps ++ "\n" ++
787 "Case: " ++ show ty ++ " " ++ show ps ++ "\n" ++
791− "TOTALITY CHECK TIME:\n\n" ++
792− show ns_t ++ " " ++ show sc_t ++ "\n\n" ++
793 "COMPILE TIME:\n\n" ++
788 "COMPILE TIME:\n\n" ++
794 show ns ++ " " ++ show sc ++ "\n\n" ++
789 show ns ++ " " ++ show sc ++ "\n\n" ++
795 "RUN TIME:\n\n" ++
790 "RUN TIME:\n\n" ++
@@ -949,42 +944,37 @@ addCasedef :: Name -> ErasureInfo -> CaseInfo ->
949 [(Type, Bool)] -> -- argument types, whether canonical
944 [(Type, Bool)] -> -- argument types, whether canonical
950 [Int] -> -- inaccessible arguments
945 [Int] -> -- inaccessible arguments
951 [Either Term (Term, Term)] ->
946 [Either Term (Term, Term)] ->
952− [([Name], Term, Term)] -> -- totality
953 [([Name], Term, Term)] -> -- compile time
947 [([Name], Term, Term)] -> -- compile time
954− [([Name], Term, Term)] -> -- inlined
955 [([Name], Term, Term)] -> -- run time
948 [([Name], Term, Term)] -> -- run time
956 Type -> Context -> TC Context
949 Type -> Context -> TC Context
957addCasedef n ei ci@(CaseInfo inline alwaysInline tcdict)
950addCasedef n ei ci@(CaseInfo inline alwaysInline tcdict)
958 tcase covering reflect asserted argtys inacc
951 tcase covering reflect asserted argtys inacc
959− ps_in ps_tot ps_inl ps_ct ps_rt ty uctxt
952+ ps_in ps_ct ps_rt ty uctxt
960 = do let ctxt = definitions uctxt
953 = do let ctxt = definitions uctxt
961 access = case lookupDefAcc n False uctxt of
954 access = case lookupDefAcc n False uctxt of
962 [(_, acc)] -> acc
955 [(_, acc)] -> acc
963 _ -> Public
956 _ -> Public
964− totalityTime <- simpleCase tcase covering reflect CompileTime emptyFC inacc argtys ps_tot ei
965 compileTime <- simpleCase tcase covering reflect CompileTime emptyFC inacc argtys ps_ct ei
957 compileTime <- simpleCase tcase covering reflect CompileTime emptyFC inacc argtys ps_ct ei
966− inlined <- simpleCase tcase covering reflect CompileTime emptyFC inacc argtys ps_inl ei
967 runtime <- simpleCase tcase covering reflect RunTime emptyFC inacc argtys ps_rt ei
958 runtime <- simpleCase tcase covering reflect RunTime emptyFC inacc argtys ps_rt ei
968− ctxt' <- case (totalityTime, compileTime, inlined, runtime) of
959+ ctxt' <- case (compileTime, runtime) of
969− (CaseDef args_tot sc_tot _,
970− CaseDef args_ct sc_ct _,
960+ ( CaseDef args_ct sc_ct _,
971− CaseDef args_inl sc_inl _,
972 CaseDef args_rt sc_rt _) ->
961 CaseDef args_rt sc_rt _) ->
973 let inl = alwaysInline -- tcdict
962 let inl = alwaysInline -- tcdict
974 inlc = (inl || small n args_ct sc_ct) && (not asserted)
963 inlc = (inl || small n args_ct sc_ct) && (not asserted)
975 inlr = inl || small n args_rt sc_rt
964 inlr = inl || small n args_rt sc_rt
976− cdef = CaseDefs (args_tot, sc_tot)
977− (args_ct, sc_ct)
965+ cdef = CaseDefs (args_ct, sc_ct)
979 (args_rt, sc_rt)
966 (args_rt, sc_rt)
980 op = (CaseOp (ci { case_inlinable = inlc })
967 op = (CaseOp (ci { case_inlinable = inlc })
981− ty argtys ps_in ps_tot cdef,
968+ ty argtys ps_in ps_ct cdef,
982 False, access, Unchecked, EmptyMI)
969 False, access, Unchecked, EmptyMI)
983 in return $ addDef n op ctxt
970 in return $ addDef n op ctxt
984-- other -> tfail (Msg $ "Error adding case def: " ++ show other)
971-- other -> tfail (Msg $ "Error adding case def: " ++ show other)
985 return uctxt { definitions = ctxt' }
972 return uctxt { definitions = ctxt' }
987−-- simplify a definition for totality checking
974+-- simplify a definition by inlining
975+-- (Note: This used to be for totality checking, and now it's actually a
976+-- no-op, but I'm keeping it here because I'll be putting it back with some
977+-- more carefully controlled inlining at some stage. --- EB)
988simplifyCasedef :: Name -> ErasureInfo -> Context -> TC Context
978simplifyCasedef :: Name -> ErasureInfo -> Context -> TC Context
989simplifyCasedef n ei uctxt
979simplifyCasedef n ei uctxt
990 = do let ctxt = definitions uctxt
980 = do let ctxt = definitions uctxt
@@ -996,8 +986,7 @@ simplifyCasedef n ei uctxt
996 pdef = map debind ps_in'
986 pdef = map debind ps_in'
997 CaseDef args sc _ <- simpleCase False (STerm Erased) False CompileTime emptyFC [] atys pdef ei
987 CaseDef args sc _ <- simpleCase False (STerm Erased) False CompileTime emptyFC [] atys pdef ei
998 return $ addDef n (CaseOp ci
988 return $ addDef n (CaseOp ci
999− ty atys ps_in' ps (cd { cases_totcheck = (args, sc),
1000− cases_compiletime = (args, sc) }),
989+ ty atys ps_in' ps (cd { cases_compiletime = (args, sc) }),
1001 inj, acc, tot, metainf) ctxt
990 inj, acc, tot, metainf) ctxt
1003 _ -> return ctxt
992 _ -> return ctxt