summaryrefslogtreecommitdiff
path: root/ocaml-binary-annot/bytecomp/instruct.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ocaml-binary-annot/bytecomp/instruct.ml')
-rw-r--r--ocaml-binary-annot/bytecomp/instruct.ml111
1 files changed, 111 insertions, 0 deletions
diff --git a/ocaml-binary-annot/bytecomp/instruct.ml b/ocaml-binary-annot/bytecomp/instruct.ml
new file mode 100644
index 0000000000..4f4fa14fa1
--- /dev/null
+++ b/ocaml-binary-annot/bytecomp/instruct.ml
@@ -0,0 +1,111 @@
+(***********************************************************************)
+(* *)
+(* Objective Caml *)
+(* *)
+(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
+(* *)
+(* Copyright 1996 Institut National de Recherche en Informatique et *)
+(* en Automatique. All rights reserved. This file is distributed *)
+(* under the terms of the Q Public License version 1.0. *)
+(* *)
+(***********************************************************************)
+
+(* $Id$ *)
+
+open Lambda
+
+type compilation_env =
+ { ce_stack: int Ident.tbl;
+ ce_heap: int Ident.tbl;
+ ce_rec: int Ident.tbl }
+
+type debug_event =
+ { mutable ev_pos: int; (* Position in bytecode *)
+ ev_module: string; (* Name of defining module *)
+ ev_loc: Location.t; (* Location in source file *)
+ ev_kind: debug_event_kind; (* Before/after event *)
+ ev_info: debug_event_info; (* Extra information *)
+ ev_typenv: Env.summary; (* Typing environment *)
+ ev_typsubst: Subst.t; (* Substitution over types *)
+ ev_compenv: compilation_env; (* Compilation environment *)
+ ev_stacksize: int; (* Size of stack frame *)
+ ev_repr: debug_event_repr } (* Position of the representative *)
+
+and debug_event_kind =
+ Event_before
+ | Event_after of Types.type_expr
+ | Event_pseudo
+
+and debug_event_info =
+ Event_function
+ | Event_return of int
+ | Event_other
+
+and debug_event_repr =
+ Event_none
+ | Event_parent of int ref
+ | Event_child of int ref
+
+type label = int (* Symbolic code labels *)
+
+type instruction =
+ Klabel of label
+ | Kacc of int
+ | Kenvacc of int
+ | Kpush
+ | Kpop of int
+ | Kassign of int
+ | Kpush_retaddr of label
+ | Kapply of int (* number of arguments *)
+ | Kappterm of int * int (* number of arguments, slot size *)
+ | Kreturn of int (* slot size *)
+ | Krestart
+ | Kgrab of int (* number of arguments *)
+ | Kclosure of label * int
+ | Kclosurerec of label list * int
+ | Koffsetclosure of int
+ | Kgetglobal of Ident.t
+ | Ksetglobal of Ident.t
+ | Kconst of structured_constant
+ | Kmakeblock of int * int (* size, tag *)
+ | Kmakefloatblock of int
+ | Kgetfield of int
+ | Ksetfield of int
+ | Kgetfloatfield of int
+ | Ksetfloatfield of int
+ | Kvectlength
+ | Kgetvectitem
+ | Ksetvectitem
+ | Kgetstringchar
+ | Ksetstringchar
+ | Kbranch of label
+ | Kbranchif of label
+ | Kbranchifnot of label
+ | Kstrictbranchif of label
+ | Kstrictbranchifnot of label
+ | Kswitch of label array * label array
+ | Kboolnot
+ | Kpushtrap of label
+ | Kpoptrap
+ | Kraise
+ | Kcheck_signals
+ | Kccall of string * int
+ | Knegint | Kaddint | Ksubint | Kmulint | Kdivint | Kmodint
+ | Kandint | Korint | Kxorint | Klslint | Klsrint | Kasrint
+ | Kintcomp of comparison
+ | Koffsetint of int
+ | Koffsetref of int
+ | Kisint
+ | Kisout
+ | Kgetmethod
+ | Kgetpubmet of int
+ | Kgetdynmet
+ | Kevent of debug_event
+ | Kstop
+
+let immed_min = -0x40000000
+and immed_max = 0x3FFFFFFF
+
+(* Actually the abstract machine accomodates -0x80000000 to 0x7FFFFFFF,
+ but these numbers overflow the Caml type int if the compiler runs on
+ a 32-bit processor. *)