X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=src%2Fruntime.ml;h=d489a64335e93c3b4f2facb5e726315be2190bc3;hb=3791216bfb2b9d966718f83fd414e8bcd5f7a066;hp=2f59c65495d905f72bfe5b7f5b9217b18660a7f5;hpb=468560acb04b8936936080e81152d926c251df30;p=SXSI%2Fxpathcomp.git diff --git a/src/runtime.ml b/src/runtime.ml index 2f59c65..d489a64 100644 --- a/src/runtime.ml +++ b/src/runtime.ml @@ -43,8 +43,7 @@ module Make (U : ResJIT.S) : S with type result_set = U.NS.t = let eval_trans auto s1 s2 trans = - LOG("top-down-run", 2, __ "Evaluating transition list:\n%!"); - LOG("top-down-run", 2, __ "%a\n%!" Translist.print trans); + LOG(__ "top-down-run" 3 "Evaluating transition list:@\n%a" Translist.print trans); Translist.fold (fun t ((a_st, a_op, a_todo) as acc)-> let q, _, m, f = Transition.node t in @@ -130,7 +129,6 @@ module Make (U : ResJIT.S) : S with type result_set = U.NS.t = else sl1 else sl2 in - eprintf "Here 1\n%!"; U.exec sl sl1 sl2 node code; res, sl end @@ -142,7 +140,6 @@ module Make (U : ResJIT.S) : S with type result_set = U.NS.t = else sl1 else sl2 in - eprintf "Here 2\n%!"; U.exec sl sl1 sl2 node code; res, sl end @@ -170,19 +167,19 @@ module Make (U : ResJIT.S) : S with type result_set = U.NS.t = let cache_apply cache auto tlist s1 s2 = let f = gen_code auto tlist s1 s2 in - LOG("grammar", 2, __ "Inserting: %i, %a, %a\n%!" + LOG(__ "grammar" 2 "Inserting: %i, %a, %a\n%!" (Uid.to_int tlist.Translist.Node.id) StateSet.print s1 StateSet.print s2); add cache tlist s1 s2 f; f end DEFINE LOOP (t, states, ctx) = ( let _t = t in - LOG("top-down-run", 3, - __ "Entering node %i with loop (tag %s, context %i) with states %a\n%!" - (Node.to_int _t) - (Tag.to_string (Tree.tag tree _t)) - (Node.to_int (ctx)) - (StateSet.print) (states)); + LOG(__ "top-down-run" 3 + "Entering node %i with loop (tag %s, context %i) with states %a" + (Node.to_int _t) + (Tag.to_string (Tree.tag tree _t)) + (Node.to_int (ctx)) + (StateSet.print) (states)); if _t == Tree.nil then nil_res else let tag = Tree.tag tree _t in @@ -192,8 +189,8 @@ DEFINE LOOP (t, states, ctx) = ( DEFINE LOOP_TAG (t, states, tag, ctx) = ( let _t = (t) in (* to avoid duplicating expression t *) - LOG("top-down-run", 3, - __ "Entering node %i with loop_tag (tag %s, context %i) with states %a\n%!" + LOG(__ "top-down-run" 3 + "Entering node %i with loop_tag (tag %s, context %i) with states %a" (Node.to_int _t) (Tag.to_string (tag)) (Node.to_int (ctx)) @@ -228,8 +225,8 @@ DEFINE LOOP_TAG (t, states, tag, ctx) = ( match opcode with | L2JIT.RETURN -> nil_res | L2JIT.CACHE -> - LOG("top-down-run", 3, - __ "Top-down cache miss for configuration %s %a\n%!" + LOG(__ "top-down-run" 3 + "Top-down cache miss for configuration %s %a" (Tag.to_string tag) StateSet.print states); let opcode = L2JIT.compile cache2 auto tree tag states in l2jit_dispatch t tag states ctx opcode @@ -521,7 +518,7 @@ let dispatch_param1 conf id2 y0 y1 = in let lambda = ref 0 in let rec start_loop idx states = - LOG("grammar", 2, __ "Node %i\n%!" (Node.to_int idx)); + LOG(__ "grammar" 2 "Node %i\n%!" (Node.to_int idx)); if states == dummy_set then nil_res else if idx < Node.null then nil_res else begin @@ -727,7 +724,7 @@ let dispatch_param1 conf id2 y0 y1 = let set a i v = - LOG("twopass", 2, __ "Setting node %i to state %a\n%!" + LOG(__ "twopass" 2 "Setting node %i to state %a\n%!" i StateSet.print v); a.(i) <- v @@ -744,7 +741,7 @@ let dispatch_param1 conf id2 y0 y1 = auto.bottom_states else let tag = Tree.tag tree t in - LOG("twopass", 2, __ "Traversing node %i (tag %s) in states %a\n%!" (Node.to_int t) (Tag.to_string tag) + LOG(__ "twopass" 2 "Traversing node %i (tag %s) in states %a\n%!" (Node.to_int t) (Tag.to_string tag) StateSet.print states ); let trans, lstates, rstates = @@ -755,8 +752,8 @@ let dispatch_param1 conf id2 y0 y1 = c else c in - LOG("twopass", 2, __ "\nTransitions are:\n%!"); - LOG("twopass", 2, __ "\nTransitions are:\n%a\n%!" + LOG(__ "twopass" 2 "\nTransitions are:\n%!"); + LOG(__ "twopass" 2"\nTransitions are:\n%a\n%!" Translist.print trans ); let s1 = loop (Tree.first_child tree t) lstates ctx @@ -818,12 +815,12 @@ let dispatch_param1 conf id2 y0 y1 = (Uid.to_int trans.Translist.Node.id) c;c else c in - LOG("twopass", 2, __ "Evaluating node %i (tag %s).\n%!States=%a\n%!" + LOG(__ "twopass" 2 "Evaluating node %i (tag %s).\n%!States=%a\n%!" (Node.to_int t) (Tag.to_string tag) StateSet.print states ); - LOG("twopass", 2, __ "Translist=%a\nLeft=%a\nRight=%a\nMark=%s\n\n%!" + LOG(__ "twopass" 2 "Translist=%a\nLeft=%a\nRight=%a\nMark=%s\n\n%!" Translist.print trans StateSet.print s1 StateSet.print s2 @@ -840,7 +837,7 @@ let dispatch_param1 conf id2 y0 y1 = let twopass_top_down_run auto tree root = let len = Node.to_int (Tree.closing tree root) + 1 in - LOG("twopass", 2, __ "Creating array of size: %i\n%!" len); + LOG(__ "twopass" 2 "Creating array of size: %i\n%!" len); let states_array = Array.make len StateSet.empty in let _, cache = twopass_top_down states_array auto tree root auto.init Tree.nil