Debian Codegraph @

kernel/vmbytecodes.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 (* $Id$ *)
12
13 open Names
14 open Vmvalues
15 open Constr
16
17 module Label :
18 sig
19 type t = int
20 val no : t
21 val create : unit -> t
22 val reset_label_counter : unit -> unit
23 end
24
25 type caml_prim =
26 | CAML_Arraymake
27 | CAML_Arrayget
28 | CAML_Arraydefault
29 | CAML_Arrayset
30 | CAML_Arraycopy
31 | CAML_Arraylength
32 | CAML_Stringmake
33 | CAML_Stringlength
34 | CAML_Stringget
35 | CAML_Stringsub
36 | CAML_Stringcat
37 | CAML_Stringcompare
38
39 type instruction =
40 | Klabel of Label.t
41 | Kacc of int (** accu = sp[n] *)
42 | Kenvacc of int (** accu = rocq_env[n] *)
43 | Koffsetclosure of int (** accu = &rocq_env[n] *)
44 | Kpush (** sp = accu :: sp *)
45 | Kpop of int (** sp = skipn n sp *)
46 | Kpush_retaddr of Label.t (** sp = pc :: rocq_env :: rocq_extra_args :: sp ; rocq_extra_args = 0 *)
47 | Kshort_apply of int (** number of arguments (arguments on top of stack) *)
48 | Kapply of int (** number of arguments (arguments on top of stack) *)
49 | Kappterm of int * int (** number of arguments, slot size *)
50 | Kreturn of int (** slot size *)
51 | Kjump
52 | Krestart
53 | Kgrab of int (** number of arguments *)
54 | Kgrabrec of int (** rec arg *)
55 | Kclosure of Label.t * int (** label, number of free variables *)
56 | Kclosurerec of int * int * Label.t array * Label.t array
57 (** nb fv, init, lbl types, lbl bodies *)
58 | Kclosurecofix of int * int * Label.t array * Label.t array
59 (** nb fv, init, lbl types, lbl bodies *)
60 | Kgetglobal of Constant.t
61 | Ksubstinstance of UVars.Instance.t
62 | Kconst of structured_constant
63 | Kmakeblock of (* size: *) int * tag (** allocate an ocaml block. Index 0
64 ** is accu, all others are popped from
65 ** the top of the stack *)
66 | Kmakeswitchblock of Label.t * Label.t * annot_switch * int
67 | Kswitch of Label.t array * Label.t array (** consts,blocks *)
68 | Kpushfields of int
69 | Kfield of int (** accu = accu[n] *)
70 | Ksetfield of int (** accu[n] = sp[0] ; sp = pop sp *)
71 | Kstop
72 | Ksequence of bytecodes
73 | Kproj of int
74 | Kensurestackcapacity of int
75
76 | Kbranch of Label.t (** jump to label, is it needed ? *)
77 | Kprim of CPrimitives.t * pconstant
78 | Kcamlprim of caml_prim * Label.t
79
80 and bytecodes = instruction list
81
82 val pp_bytecodes : bytecodes -> Pp.t
83
84 type fv_elem =
85 FVnamed of Id.t
86 | FVrel of int
87
88 type fv = fv_elem array
89
90 val pp_fv_elem : fv_elem -> Pp.t
91
92 val caml_prim_to_prim : caml_prim -> CPrimitives.t