Add copyright notices and new function String.chomp
[ocaml.git] / bytecomp / instruct.ml
blob9fd2cb94091a9f6dd382027bd61165c60fb5ffa5
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 open Lambda
17 type compilation_env =
18 { ce_stack: int Ident.tbl;
19 ce_heap: int Ident.tbl;
20 ce_rec: int Ident.tbl }
22 type debug_event =
23 { mutable ev_pos: int; (* Position in bytecode *)
24 ev_module: string; (* Name of defining module *)
25 ev_loc: Location.t; (* Location in source file *)
26 ev_kind: debug_event_kind; (* Before/after event *)
27 ev_info: debug_event_info; (* Extra information *)
28 ev_typenv: Env.summary; (* Typing environment *)
29 ev_compenv: compilation_env; (* Compilation environment *)
30 ev_stacksize: int; (* Size of stack frame *)
31 ev_repr: debug_event_repr } (* Position of the representative *)
33 and debug_event_kind =
34 Event_before
35 | Event_after of Types.type_expr
36 | Event_pseudo
38 and debug_event_info =
39 Event_function
40 | Event_return of int
41 | Event_other
43 and debug_event_repr =
44 Event_none
45 | Event_parent of int ref
46 | Event_child of int ref
48 type label = int (* Symbolic code labels *)
50 type instruction =
51 Klabel of label
52 | Kacc of int
53 | Kenvacc of int
54 | Kpush
55 | Kpop of int
56 | Kassign of int
57 | Kpush_retaddr of label
58 | Kapply of int (* number of arguments *)
59 | Kappterm of int * int (* number of arguments, slot size *)
60 | Kreturn of int (* slot size *)
61 | Krestart
62 | Kgrab of int (* number of arguments *)
63 | Kclosure of label * int
64 | Kclosurerec of label list * int
65 | Koffsetclosure of int
66 | Kgetglobal of Ident.t
67 | Ksetglobal of Ident.t
68 | Kconst of structured_constant
69 | Kmakeblock of int * int (* size, tag *)
70 | Kmakefloatblock of int
71 | Kgetfield of int
72 | Ksetfield of int
73 | Kgetfloatfield of int
74 | Ksetfloatfield of int
75 | Kvectlength
76 | Kgetvectitem
77 | Ksetvectitem
78 | Kgetstringchar
79 | Ksetstringchar
80 | Kbranch of label
81 | Kbranchif of label
82 | Kbranchifnot of label
83 | Kstrictbranchif of label
84 | Kstrictbranchifnot of label
85 | Kswitch of label array * label array
86 | Kboolnot
87 | Kpushtrap of label
88 | Kpoptrap
89 | Kraise
90 | Kcheck_signals
91 | Kccall of string * int
92 | Knegint | Kaddint | Ksubint | Kmulint | Kdivint | Kmodint
93 | Kandint | Korint | Kxorint | Klslint | Klsrint | Kasrint
94 | Kintcomp of comparison
95 | Koffsetint of int
96 | Koffsetref of int
97 | Kisint
98 | Kisout
99 | Kgetmethod
100 | Kgetpubmet of int
101 | Kgetdynmet
102 | Kevent of debug_event
103 | Kstop
105 let immed_min = -0x40000000
106 and immed_max = 0x3FFFFFFF
108 (* Actually the abstract machine accomodates -0x80000000 to 0x7FFFFFFF,
109 but these numbers overflow the Caml type int if the compiler runs on
110 a 32-bit processor. *)