Defunctorize the ResJIT module.
[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 val update :
35   ('a array -> 'a array -> 'a array -> Tree.node -> code -> unit) ->
36   'a array cache -> Ata.t -> Translist.t -> StateSet.t -> StateSet.t ->
37       'a array -> 'a array -> 'a array -> Tree.t -> Tree.node -> StateSet.t * 'a array
38
39 val count_exec : NodeSet.Count.t array -> NodeSet.Count.t array -> NodeSet.Count.t array -> Tree.node -> code -> unit
40 val mat_exec : NodeSet.Mat.t array -> NodeSet.Mat.t array -> NodeSet.Mat.t array -> Tree.node -> code -> unit
41
42 module type S =
43   sig
44     module NS : NodeSet.S
45     type t = NS.t array
46     val exec : t -> t -> t -> Tree.node -> code -> unit
47     val update : t cache -> Ata.t -> Translist.t -> StateSet.t -> StateSet.t ->
48       t -> t -> t -> Tree.t -> Tree.node -> StateSet.t * t
49     val print : Format.formatter -> t -> unit
50     val var : int -> t -> t
51     val close : ((int*State.t, NS.t) Hashtbl.t) -> t -> t
52     val is_open : t -> bool
53   end
54
55 module Count : S with type NS.t = int
56 module Mat : S with type NS.t = Tree.node NodeSet.mat
57 module Make(U : NodeSet.S) : S with type NS.t = U.t