a870bc0ac92b5ad50a43a3e15651591a05255aa7
[SXSI/xpathcomp.git] / src / resJIT.mli
1 type instr =
2   | SELF of unit
3   | LEFT of State.t
4   | RIGHT of State.t
5
6 type opcode =
7   | OP_NOP of unit
8   | OP_LEFT1 of State.t
9   | OP_LEFT2 of State.t * State.t
10   | OP_RIGHT1 of State.t
11   | OP_RIGHT2 of State.t * State.t
12   | OP_LEFT1_RIGHT1 of State.t * State.t
13   | OP_LEFT2_RIGHT1 of State.t * State.t * State.t
14   | OP_LEFT1_RIGHT2 of State.t * State.t * State.t
15   | OP_LEFT2_RIGHT2 of State.t * State.t * State.t * State.t
16   | OP_SELF of unit
17   | OP_SELF_LEFT1 of State.t
18   | OP_SELF_LEFT2 of State.t * State.t
19   | OP_SELF_RIGHT1 of State.t
20   | OP_SELF_RIGHT2 of State.t * State.t
21   | OP_SELF_LEFT1_RIGHT1 of State.t * State.t
22   | OP_SELF_LEFT2_RIGHT1 of State.t * State.t * State.t
23   | OP_SELF_LEFT1_RIGHT2 of State.t * State.t * State.t
24   | OP_SELF_LEFT2_RIGHT2 of State.t * State.t * State.t * State.t
25   | OP_OTHER of instr array
26
27 type code = Nil | Cons of State.t * opcode * code
28
29 val compile : (State.t * instr list) list -> code * bool
30 type 'a update = 'a -> 'a -> 'a -> Tree.t -> Tree.node -> StateSet.t * 'a
31 type 'a cache = 'a update Cache.Lvl3.t
32 val dummy_update : 'a update
33 val create : unit -> 'a cache
34
35 module type S =
36   sig
37     module NS : NodeSet.S
38     type t = NS.t array
39     val exec : t -> t -> t -> Tree.node -> code -> unit
40     val update : t cache -> Ata.t -> Translist.t -> StateSet.t -> StateSet.t ->
41       t -> t -> t -> Tree.t -> Tree.node -> StateSet.t * t
42     val print : Format.formatter -> t -> unit
43     val var : int -> t -> t
44     val close : ((int*State.t, NS.t) Hashtbl.t) -> t -> t
45     val is_open : t -> bool
46   end
47
48 module Count : S with type NS.t = int
49 module Mat : S with type NS.t = Tree.node NodeSet.mat
50 module Make(U : NodeSet.S) : S with type NS.t = U.t