+module Make(U : NodeSet.S) =
+ struct
+ module NS = U
+ type t = U.t array
+ let print fmt s =
+ let pr fmt (state, count) =
+ fprintf fmt "%a: %i" State.print state (NS.length count)
+ in
+ Pretty.print_array ~sep:", " pr fmt (Array.mapi (fun x y -> (x,y)) s)
+
+ let exec_instr = EXEC_INSTR_TEMPLATE(U)
+ let exec_code = EXEC_CODE_TEMPLATE(U)
+ (* inline by hand for efficiency reason *)
+ let rec exec slot slot1 slot2 t code =
+ match code with
+ | Nil -> ()
+ | Cons(dst, opcode, code1) ->
+ TRACE("res-jit", 3, __ " %a := %a\n%!"
+ State.print dst print_opcode opcode;
+ );
+ exec_code slot slot1 slot2 t dst opcode;
+ begin
+ match code1 with
+ | Nil -> ()
+ | Cons(dst, opcode, code1) ->
+ TRACE("res-jit", 3, __ " %a := %a\n%!"
+ State.print dst print_opcode opcode;
+ );
+ exec_code slot slot1 slot2 t dst opcode;
+ exec slot slot1 slot2 t code1
+ end
+
+ let exec slot slot1 slot2 t code =
+ TRACE("res-jit", 3, __ "Node %i:\n" (Node.to_int t));
+ TRACE("res-jit", 3, __ " LEFT : %a\n" pr_slot slot1);
+ TRACE("res-jit", 3, __ " RIGHT : %a\n" pr_slot slot2);
+ exec slot slot1 slot2 t code;
+ TRACE("res-jit", 3, __ " RES : %a\n\n%!" pr_slot slot)
+
+
+ let var i t =
+ Array.mapi (fun j _ -> NS.var (i,j)) t
+ let close h t =
+ Array.map (NS.close h) t
+
+ let is_open t =
+ List.exists NS.is_open (Array.to_list t)
+ end