1 (***********************************************************************)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
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. *)
11 (***********************************************************************)
17 type compilation_env
=
18 { ce_stack
: int Ident.tbl
;
19 ce_heap
: int Ident.tbl
;
20 ce_rec
: int Ident.tbl
}
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
=
35 | Event_after
of Types.type_expr
38 and debug_event_info
=
43 and debug_event_repr
=
45 | Event_parent
of int ref
46 | Event_child
of int ref
48 type label
= int (* Symbolic code labels *)
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 *)
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
73 | Kgetfloatfield
of int
74 | Ksetfloatfield
of int
82 | Kbranchifnot
of label
83 | Kstrictbranchif
of label
84 | Kstrictbranchifnot
of label
85 | Kswitch
of label array
* label array
91 | Kccall
of string * int
92 | Knegint
| Kaddint
| Ksubint
| Kmulint
| Kdivint
| Kmodint
93 | Kandint
| Korint
| Kxorint
| Klslint
| Klsrint
| Kasrint
94 | Kintcomp
of comparison
102 | Kevent
of debug_event
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. *)