1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
2011-07-27 07:17:02 -07:00
|
|
|
(* OCaml *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1999-11-17 10:59:06 -08:00
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
|
|
|
(* under the terms of the Q Public License version 1.0. *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
1995-07-02 09:41:48 -07:00
|
|
|
(* A variant of the "lambda" code with direct / indirect calls explicit
|
|
|
|
and closures explicit too *)
|
|
|
|
|
|
|
|
open Asttypes
|
|
|
|
open Lambda
|
|
|
|
|
|
|
|
type function_label = string
|
|
|
|
|
|
|
|
type ulambda =
|
|
|
|
Uvar of Ident.t
|
2011-03-29 00:58:53 -07:00
|
|
|
| Uconst of structured_constant * string option
|
2007-01-29 04:11:18 -08:00
|
|
|
| Udirect_apply of function_label * ulambda list * Debuginfo.t
|
|
|
|
| Ugeneric_apply of ulambda * ulambda list * Debuginfo.t
|
2012-02-21 09:41:02 -08:00
|
|
|
| Uclosure of ufunction list * ulambda list
|
1995-07-07 05:07:07 -07:00
|
|
|
| Uoffset of ulambda * int
|
1995-07-02 09:41:48 -07:00
|
|
|
| Ulet of Ident.t * ulambda * ulambda
|
|
|
|
| Uletrec of (Ident.t * ulambda) list * ulambda
|
2007-01-29 04:11:18 -08:00
|
|
|
| Uprim of primitive * ulambda list * Debuginfo.t
|
1996-04-04 07:54:25 -08:00
|
|
|
| Uswitch of ulambda * ulambda_switch
|
2000-10-02 07:08:30 -07:00
|
|
|
| Ustaticfail of int * ulambda list
|
|
|
|
| Ucatch of int * Ident.t list * ulambda * ulambda
|
1995-07-02 09:41:48 -07:00
|
|
|
| Utrywith of ulambda * Ident.t * ulambda
|
|
|
|
| Uifthenelse of ulambda * ulambda * ulambda
|
|
|
|
| Usequence of ulambda * ulambda
|
|
|
|
| Uwhile of ulambda * ulambda
|
|
|
|
| Ufor of Ident.t * ulambda * ulambda * direction_flag * ulambda
|
1995-11-25 07:38:43 -08:00
|
|
|
| Uassign of Ident.t * ulambda
|
2007-01-29 04:11:18 -08:00
|
|
|
| Usend of meth_kind * ulambda * ulambda * ulambda list * Debuginfo.t
|
1995-07-02 09:41:48 -07:00
|
|
|
|
2012-02-21 09:41:02 -08:00
|
|
|
and ufunction = {
|
|
|
|
label : function_label;
|
|
|
|
arity : int;
|
|
|
|
params : Ident.t list;
|
|
|
|
body : ulambda;
|
|
|
|
dbg : Debuginfo.t
|
|
|
|
}
|
|
|
|
|
1996-04-04 07:54:25 -08:00
|
|
|
and ulambda_switch =
|
|
|
|
{ us_index_consts: int array;
|
2001-02-19 12:15:42 -08:00
|
|
|
us_actions_consts : ulambda array;
|
1996-04-04 07:54:25 -08:00
|
|
|
us_index_blocks: int array;
|
2001-02-19 12:15:42 -08:00
|
|
|
us_actions_blocks: ulambda array}
|
1996-04-04 07:54:25 -08:00
|
|
|
|
1995-07-02 09:41:48 -07:00
|
|
|
(* Description of known functions *)
|
|
|
|
|
|
|
|
type function_description =
|
|
|
|
{ fun_label: function_label; (* Label of direct entry point *)
|
|
|
|
fun_arity: int; (* Number of arguments *)
|
1997-02-16 09:20:11 -08:00
|
|
|
mutable fun_closed: bool; (* True if environment not used *)
|
|
|
|
mutable fun_inline: (Ident.t list * ulambda) option }
|
1995-07-02 09:41:48 -07:00
|
|
|
|
|
|
|
(* Approximation of values *)
|
|
|
|
|
|
|
|
type value_approximation =
|
|
|
|
Value_closure of function_description * value_approximation
|
|
|
|
| Value_tuple of value_approximation array
|
|
|
|
| Value_unknown
|
1998-04-30 05:11:35 -07:00
|
|
|
| Value_integer of int
|
1999-01-29 00:50:24 -08:00
|
|
|
| Value_constptr of int
|