Sys.Signals module for a Variant type of signals (and a set_signal function that...
[ocaml.git] / bytecomp / instruct.mli
blob31f526d22e9c18320501a6708591a632c871d095
1 (***********************************************************************)
2 (* *)
3 (* Objective Caml *)
4 (* *)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
6 (* *)
7 (* Copyright 1996 Institut National de Recherche en Informatique et *)
8 (* en Automatique. All rights reserved. This file is distributed *)
9 (* under the terms of the Q Public License version 1.0. *)
10 (* *)
11 (***********************************************************************)
13 (* $Id$ *)
15 (* The type of the instructions of the abstract machine *)
17 open Lambda
19 (* Structure of compilation environments *)
21 type compilation_env =
22 { ce_stack: int Ident.tbl; (* Positions of variables in the stack *)
23 ce_heap: int Ident.tbl; (* Structure of the heap-allocated env *)
24 ce_rec: int Ident.tbl } (* Functions bound by the same let rec *)
26 (* The ce_stack component gives locations of variables residing
27 in the stack. The locations are offsets w.r.t. the origin of the
28 stack frame.
29 The ce_heap component gives the positions of variables residing in the
30 heap-allocated environment.
31 The ce_rec component associate offsets to identifiers for functions
32 bound by the same let rec as the current function. The offsets
33 are used by the OFFSETCLOSURE instruction to recover the closure
34 pointer of the desired function from the env register (which
35 points to the closure for the current function). *)
37 (* Debugging events *)
39 (* Warning: when you change these types, check byterun/backtrace.c *)
40 type debug_event =
41 { mutable ev_pos: int; (* Position in bytecode *)
42 ev_module: string; (* Name of defining module *)
43 ev_loc: Location.t; (* Location in source file *)
44 ev_kind: debug_event_kind; (* Before/after event *)
45 ev_info: debug_event_info; (* Extra information *)
46 ev_typenv: Env.summary; (* Typing environment *)
47 ev_compenv: compilation_env; (* Compilation environment *)
48 ev_stacksize: int; (* Size of stack frame *)
49 ev_repr: debug_event_repr } (* Position of the representative *)
51 and debug_event_kind =
52 Event_before
53 | Event_after of Types.type_expr
54 | Event_pseudo
56 and debug_event_info =
57 Event_function
58 | Event_return of int
59 | Event_other
61 and debug_event_repr =
62 Event_none
63 | Event_parent of int ref
64 | Event_child of int ref
66 (* Abstract machine instructions *)
68 type label = int (* Symbolic code labels *)
70 type instruction =
71 Klabel of label
72 | Kacc of int
73 | Kenvacc of int
74 | Kpush
75 | Kpop of int
76 | Kassign of int
77 | Kpush_retaddr of label
78 | Kapply of int (* number of arguments *)
79 | Kappterm of int * int (* number of arguments, slot size *)
80 | Kreturn of int (* slot size *)
81 | Krestart
82 | Kgrab of int (* number of arguments *)
83 | Kclosure of label * int
84 | Kclosurerec of label list * int
85 | Koffsetclosure of int
86 | Kgetglobal of Ident.t
87 | Ksetglobal of Ident.t
88 | Kconst of structured_constant
89 | Kmakeblock of int * int (* size, tag *)
90 | Kmakefloatblock of int
91 | Kgetfield of int
92 | Ksetfield of int
93 | Kgetfloatfield of int
94 | Ksetfloatfield of int
95 | Kvectlength
96 | Kgetvectitem
97 | Ksetvectitem
98 | Kgetstringchar
99 | Ksetstringchar
100 | Kbranch of label
101 | Kbranchif of label
102 | Kbranchifnot of label
103 | Kstrictbranchif of label
104 | Kstrictbranchifnot of label
105 | Kswitch of label array * label array
106 | Kboolnot
107 | Kpushtrap of label
108 | Kpoptrap
109 | Kraise
110 | Kcheck_signals
111 | Kccall of string * int
112 | Knegint | Kaddint | Ksubint | Kmulint | Kdivint | Kmodint
113 | Kandint | Korint | Kxorint | Klslint | Klsrint | Kasrint
114 | Kintcomp of comparison
115 | Koffsetint of int
116 | Koffsetref of int
117 | Kisint
118 | Kisout
119 | Kgetmethod
120 | Kgetpubmet of int
121 | Kgetdynmet
122 | Kevent of debug_event
123 | Kstop
125 val immed_min: int
126 val immed_max: int