|
@@ -531,7 +531,6 @@ let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=f
|
|
| Some e -> Some (f e)
|
|
| Some e -> Some (f e)
|
|
in
|
|
in
|
|
let in_loop = ref false in
|
|
let in_loop = ref false in
|
|
- let cancel_inlining = ref false in
|
|
|
|
let return_type t el =
|
|
let return_type t el =
|
|
(* If the function return is Dynamic or Void, stick to it. *)
|
|
(* If the function return is Dynamic or Void, stick to it. *)
|
|
if follow f.tf_type == t_dynamic || ExtType.is_void (follow f.tf_type) then f.tf_type
|
|
if follow f.tf_type == t_dynamic || ExtType.is_void (follow f.tf_type) then f.tf_type
|
|
@@ -551,9 +550,6 @@ let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=f
|
|
l.i_called <- l.i_called + i
|
|
l.i_called <- l.i_called + i
|
|
else
|
|
else
|
|
l.i_read <- l.i_read + i;
|
|
l.i_read <- l.i_read + i;
|
|
- (* never inline a function which contain a delayed macro because its bound
|
|
|
|
- to its variables and not the calling method *)
|
|
|
|
- if v.v_name = "$__delayed_call__" then cancel_inlining := true;
|
|
|
|
let e = { e with eexpr = TLocal l.i_subst } in
|
|
let e = { e with eexpr = TLocal l.i_subst } in
|
|
if l.i_abstract_this then mk (TCast(e,None)) v.v_type e.epos else e
|
|
if l.i_abstract_this then mk (TCast(e,None)) v.v_type e.epos else e
|
|
| TConst TThis ->
|
|
| TConst TThis ->
|
|
@@ -705,22 +701,18 @@ let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=f
|
|
Type.map_expr (map false false) e
|
|
Type.map_expr (map false false) e
|
|
in
|
|
in
|
|
let e = map true false f.tf_expr in
|
|
let e = map true false f.tf_expr in
|
|
- if !cancel_inlining then
|
|
|
|
- None
|
|
|
|
- else begin
|
|
|
|
let tl = List.map (fun e -> "",false,e.etype) params in
|
|
let tl = List.map (fun e -> "",false,e.etype) params in
|
|
- let e = state#finalize config e tl tret p in
|
|
|
|
- if Meta.has (Meta.Custom ":inlineDebug") ctx.meta then begin
|
|
|
|
- let se t = s_expr_pretty true t true (s_type (print_context())) in
|
|
|
|
- print_endline (Printf.sprintf "Inline %s:\n\tArgs: %s\n\tExpr: %s\n\tResult: %s"
|
|
|
|
- cf.cf_name
|
|
|
|
- (String.concat "" (List.map (fun (i,e) -> Printf.sprintf "\n\t\t%s<%i> = %s" (i.i_subst.v_name) (i.i_subst.v_id) (se "\t\t" e)) state#inlined_vars))
|
|
|
|
- (se "\t" f.tf_expr)
|
|
|
|
- (se "\t" e)
|
|
|
|
- );
|
|
|
|
- end;
|
|
|
|
- Some e
|
|
|
|
- end
|
|
|
|
|
|
+ let e = state#finalize config e tl tret p in
|
|
|
|
+ if Meta.has (Meta.Custom ":inlineDebug") ctx.meta then begin
|
|
|
|
+ let se t = s_expr_pretty true t true (s_type (print_context())) in
|
|
|
|
+ print_endline (Printf.sprintf "Inline %s:\n\tArgs: %s\n\tExpr: %s\n\tResult: %s"
|
|
|
|
+ cf.cf_name
|
|
|
|
+ (String.concat "" (List.map (fun (i,e) -> Printf.sprintf "\n\t\t%s<%i> = %s" (i.i_subst.v_name) (i.i_subst.v_id) (se "\t\t" e)) state#inlined_vars))
|
|
|
|
+ (se "\t" f.tf_expr)
|
|
|
|
+ (se "\t" e)
|
|
|
|
+ );
|
|
|
|
+ end;
|
|
|
|
+ Some e
|
|
|
|
|
|
(* Same as type_inline, but modifies the function body to add field inits *)
|
|
(* Same as type_inline, but modifies the function body to add field inits *)
|
|
and type_inline_ctor ctx c cf tf ethis el po =
|
|
and type_inline_ctor ctx c cf tf ethis el po =
|