summaryrefslogtreecommitdiff
path: root/src/lem_interp
diff options
context:
space:
mode:
authorGabriel Kerneis2014-04-04 11:14:25 +0100
committerGabriel Kerneis2014-04-04 11:14:25 +0100
commit78703f987512fbc90ccccea4b813f24fe0ccd49a (patch)
treedbfbf4fb49793db6d495cb1098b7b25b113fb948 /src/lem_interp
parent6211671cf52fb51aafe46438ba408d3e3e009734 (diff)
Improve Power execution
- Move FDE loop to the OCaml side of the Power model (avoid leaking memory due to lack of TCO in interpreter) - Display cycle count - Check the value of CIA at the end of each cycle and stop if it is equal to the initial value of LR, returning the value in GPR3.
Diffstat (limited to 'src/lem_interp')
-rw-r--r--src/lem_interp/run_interp.ml6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lem_interp/run_interp.ml b/src/lem_interp/run_interp.ml
index 7100a197..556e61c6 100644
--- a/src/lem_interp/run_interp.ml
+++ b/src/lem_interp/run_interp.ml
@@ -208,14 +208,14 @@ let run
?(mem=Mem.empty)
(name, test) =
let rec loop env = function
- | Value (v, _) -> eprintf "%s: returned %s\n" name (val_to_string v); true
+ | Value (v, _) -> eprintf "%s: returned %s\n" name (val_to_string v); true, env
| Action (a, s) ->
eprintf "%s: suspended on action %s\n" name (act_to_string a);
(*eprintf "%s: suspended on action %s, with stack %s\n" name (act_to_string a) (stack_to_string s);*)
let return, env' = perform_action env a in
eprintf "%s: action returned %s\n" name (val_to_string return);
loop env' (resume test s return)
- | Error(l, e) -> eprintf "%s: %s: error: %s\n" name (loc_to_string l) e; false in
+ | Error(l, e) -> eprintf "%s: %s: error: %s\n" name (loc_to_string l) e; false, env in
eprintf "%s: starting\n" name;
try
Printexc.record_backtrace true;
@@ -223,5 +223,5 @@ let run
with e ->
let trace = Printexc.get_backtrace () in
eprintf "%s: interpretor error %s\n%s\n" name (Printexc.to_string e) trace;
- false
+ false, (reg, mem)
;;