Code_Runtime.trace
authorhaftmann
Tue, 26 Oct 2010 11:20:14 +0200
changeset 40150 1348d4982a17
parent 40147 d170c322157a
child 40151 752a26dce4be
child 40159 bfc716a96e47
child 40167 e44d04716920
Code_Runtime.trace
src/Tools/Code/code_runtime.ML
--- a/src/Tools/Code/code_runtime.ML	Tue Oct 26 11:00:17 2010 +0200
+++ b/src/Tools/Code/code_runtime.ML	Tue Oct 26 11:20:14 2010 +0200
@@ -29,6 +29,7 @@
     -> theory -> theory
   datatype truth = Holds
   val put_truth: (unit -> truth) -> Proof.context -> Proof.context
+  val trace: bool Unsynchronized.ref
   val polyml_as_definition: (binding * typ) list -> Path.T list -> theory -> theory
 end;
 
@@ -59,8 +60,11 @@
   #> fold (Code_Target.add_reserved target) ["oo", "ooo", "oooo", "upto", "downto", "orf", "andf"]));
        (*avoid further pervasive infix names*)
 
+val trace = Unsynchronized.ref false;
+
 fun exec verbose code =
-  ML_Context.exec (fn () => Secure.use_text ML_Env.local_context (0, "generated code") false code);
+  (if ! trace then tracing code else ();
+  ML_Context.exec (fn () => Secure.use_text ML_Env.local_context (0, "generated code") false code));
 
 fun value ctxt (get, put, put_ml) (prelude, value) =
   let