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 (***********************************************************************)
15 (* A variant of the "lambda" code with direct / indirect calls explicit
16 and closures explicit too *)
21 type function_label
= string
25 | Uconst
of structured_constant
26 | Udirect_apply
of function_label
* ulambda list
* Debuginfo.t
27 | Ugeneric_apply
of ulambda
* ulambda list
* Debuginfo.t
28 | Uclosure
of (function_label
* int * Ident.t list
* ulambda
) list
30 | Uoffset
of ulambda
* int
31 | Ulet
of Ident.t
* ulambda
* ulambda
32 | Uletrec
of (Ident.t
* ulambda
) list
* ulambda
33 | Uprim
of primitive
* ulambda list
* Debuginfo.t
34 | Uswitch
of ulambda
* ulambda_switch
35 | Ustaticfail
of int * ulambda list
36 | Ucatch
of int * Ident.t list
* ulambda
* ulambda
37 | Utrywith
of ulambda
* Ident.t
* ulambda
38 | Uifthenelse
of ulambda
* ulambda
* ulambda
39 | Usequence
of ulambda
* ulambda
40 | Uwhile
of ulambda
* ulambda
41 | Ufor
of Ident.t
* ulambda
* ulambda
* direction_flag
* ulambda
42 | Uassign
of Ident.t
* ulambda
43 | Usend
of meth_kind
* ulambda
* ulambda
* ulambda list
* Debuginfo.t
46 { us_index_consts
: int array
;
47 us_actions_consts
: ulambda array
;
48 us_index_blocks
: int array
;
49 us_actions_blocks
: ulambda array
}
51 (* Description of known functions *)
53 type function_description
=
54 { fun_label
: function_label
; (* Label of direct entry point *)
55 fun_arity
: int; (* Number of arguments *)
56 mutable fun_closed
: bool; (* True if environment not used *)
57 mutable fun_inline
: (Ident.t list
* ulambda
) option }
59 (* Approximation of values *)
61 type value_approximation
=
62 Value_closure
of function_description
* value_approximation
63 | Value_tuple
of value_approximation array
65 | Value_integer
of int
66 | Value_constptr
of int