|
@@ -692,23 +692,27 @@ and jit_tfunction jit static pos tf =
|
|
and get_env_creation jit static file info =
|
|
and get_env_creation jit static file info =
|
|
create_env_info static file info jit.capture_infos jit.max_num_locals (Hashtbl.length jit.captures)
|
|
create_env_info static file info jit.capture_infos jit.max_num_locals (Hashtbl.length jit.captures)
|
|
|
|
|
|
|
|
+let jit_timer ctx f =
|
|
|
|
+ Std.finally (Timer.timer [(if ctx.is_macro then "macro" else "interp");"jit"]) f ()
|
|
|
|
+
|
|
(* Creates a [EvalValue.vfunc] of function [tf], which can be [static] or not. *)
|
|
(* Creates a [EvalValue.vfunc] of function [tf], which can be [static] or not. *)
|
|
let jit_tfunction ctx key_type key_field tf static pos =
|
|
let jit_tfunction ctx key_type key_field tf static pos =
|
|
- let t = Timer.timer [(if ctx.is_macro then "macro" else "interp");"jit"] in
|
|
|
|
- (* Create a new JitContext with an initial scope *)
|
|
|
|
- let jit = EvalJitContext.create ctx in
|
|
|
|
- let fl,exec = jit_tfunction jit static pos tf in
|
|
|
|
- (* Create the [vfunc] instance depending on the number of arguments. *)
|
|
|
|
- let hasret = jit.has_nonfinal_return in
|
|
|
|
- let eci = get_env_creation jit static tf.tf_expr.epos.pfile (EKMethod(key_type,key_field)) in
|
|
|
|
- let f = if hasret then create_function ctx eci exec fl else create_function_noret ctx eci exec fl in
|
|
|
|
- t();
|
|
|
|
- f
|
|
|
|
|
|
+ let f () =
|
|
|
|
+ (* Create a new JitContext with an initial scope *)
|
|
|
|
+ let jit = EvalJitContext.create ctx in
|
|
|
|
+ let fl,exec = jit_tfunction jit static pos tf in
|
|
|
|
+ (* Create the [vfunc] instance depending on the number of arguments. *)
|
|
|
|
+ let hasret = jit.has_nonfinal_return in
|
|
|
|
+ let eci = get_env_creation jit static tf.tf_expr.epos.pfile (EKMethod(key_type,key_field)) in
|
|
|
|
+ if hasret then create_function ctx eci exec fl else create_function_noret ctx eci exec fl
|
|
|
|
+ in
|
|
|
|
+ jit_timer ctx f
|
|
|
|
|
|
(* JITs expression [e] to a function. This is used for expressions that are not in a method. *)
|
|
(* JITs expression [e] to a function. This is used for expressions that are not in a method. *)
|
|
let jit_expr ctx e =
|
|
let jit_expr ctx e =
|
|
- let t = Timer.timer [(if ctx.is_macro then "macro" else "interp");"jit"] in
|
|
|
|
- let jit = EvalJitContext.create ctx in
|
|
|
|
- let f = jit_expr jit false (mk_block e) in
|
|
|
|
- t();
|
|
|
|
- jit,f
|
|
|
|
|
|
+ let f () =
|
|
|
|
+ let jit = EvalJitContext.create ctx in
|
|
|
|
+ let f = jit_expr jit false (mk_block e) in
|
|
|
|
+ jit,f
|
|
|
|
+ in
|
|
|
|
+ jit_timer ctx f
|