@@ -29,6 +29,7 @@ data EvalOpt = Spec
30 | Simplify
30 | Simplify
32 deriving (Show, Eq)
33 deriving (Show, Eq)
34initEval = ES [] 0
35initEval = ES [] 0
@@ -162,6 +163,7 @@ eval :: Bool -> Context -> [(Name, Int)] -> Env -> TT Name ->
162eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
163eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
163 spec = Spec `elem` opts
164 spec = Spec `elem` opts
164 simpl = Simplify `elem` opts
165 simpl = Simplify `elem` opts
166+ runtime = RunTT `elem` opts
165 atRepl = AtREPL `elem` opts
167 atRepl = AtREPL `elem` opts
166 hnf = HNF `elem` opts
168 hnf = HNF `elem` opts
@@ -173,6 +175,10 @@ eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
173 || (n == UN "prim__syntactic_eq")
175 || (n == UN "prim__syntactic_eq")
174 | otherwise = False
176 | otherwise = False
178+ getCases cd | simpl = cases_totcheck cd
179+ | runtime = cases_runtime cd
180+ | otherwise = cases_compiletime cd
176 ev ntimes stk top env (P _ n ty)
182 ev ntimes stk top env (P _ n ty)
177 | Just (Let t v) <- lookup n genv = ev ntimes stk top env v
183 | Just (Let t v) <- lookup n genv = ev ntimes stk top env v
178 ev ntimes_in stk top env (P Ref n ty)
184 ev ntimes_in stk top env (P Ref n ty)
@@ -189,8 +195,7 @@ eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
189 [(CaseOp ci _ _ _ cd, acc)]
195 [(CaseOp ci _ _ _ cd, acc)]
190 | acc == Public &&
196 | acc == Public &&
191 null (fst (cases_totcheck cd)) -> -- unoptimised version
197 null (fst (cases_totcheck cd)) -> -- unoptimised version
192− let (_, tree) = if simpl then cases_totcheck cd
198+ let (_, tree) = getCases cd in
193− else cases_compiletime cd in
194 if blockSimplify ci n stk
199 if blockSimplify ci n stk
195 then liftM (VP Ref n) (ev ntimes stk top env ty)
200 then liftM (VP Ref n) (ev ntimes stk top env ty)
196 else do c <- evCase ntimes n (n:stk) top env [] [] tree
201 else do c <- evCase ntimes n (n:stk) top env [] [] tree
@@ -261,8 +266,7 @@ eval traceon ctxt ntimes genv tm opts = ev ntimes [] True [] tm where
261 case val of
266 case val of
262 [(CaseOp ci _ _ _ cd, acc)]
267 [(CaseOp ci _ _ _ cd, acc)]
263 | acc == Public -> -- unoptimised version
268 | acc == Public -> -- unoptimised version
264− let (ns, tree) = if simpl then cases_totcheck cd
269+ let (ns, tree) = getCases cd in
265− else cases_compiletime cd in
266 if blockSimplify ci n stk
270 if blockSimplify ci n stk
267 then return $ unload env (VP Ref n ty) args
271 then return $ unload env (VP Ref n ty) args
268 else do c <- evCase ntimes n (n:stk) top env ns args tree
272 else do c <- evCase ntimes n (n:stk) top env ns args tree