summaryrefslogtreecommitdiff
path: root/asmcomp/closure.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2012-02-21 17:41:02 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2012-02-21 17:41:02 +0000
commit2eecf2d4c0933f64bcfa3e620f031497166db338 (patch)
tree38eeb1c84b8be72a918fbbc8ef5498c02840755b /asmcomp/closure.ml
parentfd515e3a166e8fcb30188f4aa4a2d07e25c2de98 (diff)
downloadocaml-2eecf2d4c0933f64bcfa3e620f031497166db338.tar.gz
PR#5487: addition of CFI directives and a few filename/linenumber info to generated amd64 and i386 assembly files.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12179 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'asmcomp/closure.ml')
-rw-r--r--asmcomp/closure.ml16
1 files changed, 12 insertions, 4 deletions
diff --git a/asmcomp/closure.ml b/asmcomp/closure.ml
index e42f88ba3f..03ed0c1241 100644
--- a/asmcomp/closure.ml
+++ b/asmcomp/closure.ml
@@ -748,6 +748,9 @@ and close_functions fenv cenv fun_defs =
let useless_env = ref initially_closed in
(* Translate each function definition *)
let clos_fundef (id, params, body, fundesc) env_pos =
+ let dbg = match body with
+ | Levent (_,({lev_kind=Lev_function} as ev)) -> Debuginfo.from_call ev
+ | _ -> Debuginfo.none in
let env_param = Ident.create "env" in
let cenv_fv =
build_closure_env env_param (fv_pos - env_pos) fv in
@@ -759,7 +762,11 @@ and close_functions fenv cenv fun_defs =
let (ubody, approx) = close fenv_rec cenv_body body in
if !useless_env && occurs_var env_param ubody then useless_env := false;
let fun_params = if !useless_env then params else params @ [env_param] in
- ((fundesc.fun_label, fundesc.fun_arity, fun_params, ubody),
+ ({ label = fundesc.fun_label;
+ arity = fundesc.fun_arity;
+ params = fun_params;
+ body = ubody;
+ dbg },
(id, env_pos, Value_closure(fundesc, approx))) in
(* Translate all function definitions. *)
let clos_info_list =
@@ -789,11 +796,12 @@ and close_functions fenv cenv fun_defs =
and close_one_function fenv cenv id funct =
match close_functions fenv cenv [id, funct] with
- ((Uclosure([_, _, params, body], _) as clos),
+ ((Uclosure([f], _) as clos),
[_, _, (Value_closure(fundesc, _) as approx)]) ->
(* See if the function can be inlined *)
- if lambda_smaller body (!Clflags.inline_threshold + List.length params)
- then fundesc.fun_inline <- Some(params, body);
+ if lambda_smaller f.body
+ (!Clflags.inline_threshold + List.length f.params)
+ then fundesc.fun_inline <- Some(f.params, f.body);
(clos, approx)
| _ -> fatal_error "Closure.close_one_function"