12
val cofix_evaluated_tag : tag
14
type structured_constant =
15
| Const_sorts of sorts
16
| Const_ind of inductive
18
| Const_bn of tag * structured_constant array
20
type reloc_table = (tag * int) array
23
{ci : case_info; rtbl : reloc_table; tailcall : bool}
29
val create : unit -> t
30
val reset_label_counter : unit -> unit
37
| Koffsetclosure of int
40
| Kpush_retaddr of Label.t
41
| Kapply of int (* number of arguments *)
42
| Kappterm of int * int (* number of arguments, slot size *)
43
| Kreturn of int (* slot size *)
46
| Kgrab of int (* number of arguments *)
47
| Kgrabrec of int (* rec arg *)
48
| Kclosure of Label.t * int (* label, number of free variables *)
49
| Kclosurerec of int * int * Label.t array * Label.t array
50
(* nb fv, init, lbl types, lbl bodies *)
51
| Kclosurecofix of int * int * Label.t array * Label.t array
52
(* nb fv, init, lbl types, lbl bodies *)
53
| Kgetglobal of constant
54
| Kconst of structured_constant
55
| Kmakeblock of int * tag (* size, tag *)
57
| Kmakeswitchblock of Label.t * Label.t * annot_switch * int
58
| Kswitch of Label.t array * Label.t array (* consts,blocks *)
63
| Ksequence of bytecodes * bytecodes
64
(* spiwack: instructions concerning integers *)
65
| Kbranch of Label.t (* jump to label, is it needed ? *)
66
| Kaddint31 (* adds the int31 in the accu
67
and the one ontop of the stack *)
68
| Kaddcint31 (* makes the sum and keeps the carry *)
69
| Kaddcarrycint31 (* sum +1, keeps the carry *)
70
| Ksubint31 (* subtraction modulo *)
71
| Ksubcint31 (* subtraction, keeps the carry *)
72
| Ksubcarrycint31 (* subtraction -1, keeps the carry *)
73
| Kmulint31 (* multiplication modulo *)
74
| Kmulcint31 (* multiplication, result in two
75
int31, for exact computation *)
76
| Kdiv21int31 (* divides a double size integer
77
(represented by an int31 in the
78
accumulator and one on the top of
79
the stack) by an int31. The result
80
is a pair of the quotient and the
82
If the divisor is 0, it returns
84
| Kdivint31 (* euclidian division (returns a pair
86
| Kaddmuldivint31 (* generic operation for shifting and
87
cycling. Takes 3 int31 i j and s,
88
and returns x*2^s+y/(2^(31-s) *)
89
| Kcompareint31 (* unsigned comparison of int31
91
kernel/byterun/coq_interp.c
93
| Khead0int31 (* Give the numbers of 0 in head of a in31*)
94
| Ktail0int31 (* Give the numbers of 0 in tail of a in31
96
| Kisconst of Label.t (* conditional jump *)
97
| Kareconst of int*Label.t (* conditional jump *)
98
| Kcompint31 (* dynamic compilation of int31 *)
99
| Kdecompint31 (* dynamix decompilation of int31 *)
103
and bytecodes = instruction list
105
type fv_elem = FVnamed of identifier | FVrel of int
107
type fv = fv_elem array
110
(* spiwack: this exception is expected to be raised by function expecting
114
(*spiwack: both type have been moved from Cbytegen because I needed then
115
for the retroknowledge *)
117
size : int; (* longueur de la liste [n] *)
118
fv_rev : fv_elem list (* [fvn; ... ;fv1] *)
123
nb_stack : int; (* nbre de variables sur la pile *)
124
in_stack : int list; (* position dans la pile *)
125
nb_rec : int; (* nbre de fonctions mutuellement *)
126
(* recursives = nbr *)
127
pos_rec : instruction list; (* instruction d'acces pour les variables *)
128
(* de point fix ou de cofix *)
133
val draw_instr : bytecodes -> unit
137
(*spiwack: moved this here because I needed it for retroknowledge *)
140
| Bstrconst of structured_constant
141
| Bmakeblock of int * block array
142
| Bconstruct_app of int * int * int * block array
143
(* tag , nparams, arity *)
144
| Bspecial of (comp_env -> block array -> int -> bytecodes -> bytecodes) * block array
145
(* compilation function (see get_vm_constant_dynamic_info in
146
retroknowledge.mli for more info) , argument array *)