Merge pull request #480 from mshinwell/flambda_unbox-closures
GPR#480: Flambda fix: try to make Unbox_closures behave more reasonablymaster
commit
b1d1eed3af
381
.depend
381
.depend
|
@ -1,6 +1,6 @@
|
|||
utils/arg_helper.cmi :
|
||||
utils/ccomp.cmi :
|
||||
utils/clflags.cmi : utils/numbers.cmi utils/misc.cmi
|
||||
utils/clflags.cmi : utils/misc.cmi
|
||||
utils/config.cmi :
|
||||
utils/consistbl.cmi :
|
||||
utils/identifiable.cmi :
|
||||
|
@ -150,10 +150,10 @@ typing/cmt_format.cmi : typing/types.cmi typing/typedtree.cmi \
|
|||
typing/ctype.cmi : typing/types.cmi typing/path.cmi parsing/longident.cmi \
|
||||
typing/ident.cmi typing/env.cmi parsing/asttypes.cmi
|
||||
typing/datarepr.cmi : typing/types.cmi typing/path.cmi typing/ident.cmi
|
||||
typing/envaux.cmi : typing/subst.cmi typing/path.cmi typing/env.cmi
|
||||
typing/env.cmi : utils/warnings.cmi typing/types.cmi typing/subst.cmi \
|
||||
typing/path.cmi parsing/longident.cmi parsing/location.cmi \
|
||||
typing/ident.cmi utils/consistbl.cmi parsing/asttypes.cmi
|
||||
typing/envaux.cmi : typing/subst.cmi typing/path.cmi typing/env.cmi
|
||||
typing/ident.cmi : utils/identifiable.cmi
|
||||
typing/includeclass.cmi : typing/types.cmi typing/env.cmi typing/ctype.cmi
|
||||
typing/includecore.cmi : typing/types.cmi typing/typedtree.cmi \
|
||||
|
@ -172,10 +172,10 @@ typing/path.cmi : typing/ident.cmi
|
|||
typing/predef.cmi : typing/types.cmi typing/path.cmi typing/ident.cmi
|
||||
typing/primitive.cmi : parsing/parsetree.cmi typing/outcometree.cmi \
|
||||
parsing/location.cmi
|
||||
typing/printtyped.cmi : typing/typedtree.cmi
|
||||
typing/printtyp.cmi : typing/types.cmi typing/path.cmi \
|
||||
typing/outcometree.cmi parsing/longident.cmi typing/ident.cmi \
|
||||
typing/env.cmi parsing/asttypes.cmi
|
||||
typing/printtyped.cmi : typing/typedtree.cmi
|
||||
typing/stypes.cmi : typing/typedtree.cmi parsing/location.cmi \
|
||||
typing/annot.cmi
|
||||
typing/subst.cmi : typing/types.cmi typing/path.cmi typing/ident.cmi
|
||||
|
@ -191,11 +191,11 @@ typing/typedecl.cmi : typing/types.cmi typing/typedtree.cmi typing/path.cmi \
|
|||
parsing/parsetree.cmi parsing/longident.cmi parsing/location.cmi \
|
||||
typing/includecore.cmi typing/ident.cmi typing/env.cmi \
|
||||
parsing/asttypes.cmi
|
||||
typing/typedtreeIter.cmi : typing/typedtree.cmi parsing/asttypes.cmi
|
||||
typing/typedtreeMap.cmi : typing/typedtree.cmi
|
||||
typing/typedtree.cmi : typing/types.cmi typing/primitive.cmi typing/path.cmi \
|
||||
parsing/parsetree.cmi parsing/longident.cmi parsing/location.cmi \
|
||||
typing/ident.cmi typing/env.cmi parsing/asttypes.cmi
|
||||
typing/typedtreeIter.cmi : typing/typedtree.cmi parsing/asttypes.cmi
|
||||
typing/typedtreeMap.cmi : typing/typedtree.cmi
|
||||
typing/typemod.cmi : typing/types.cmi typing/typedtree.cmi typing/path.cmi \
|
||||
parsing/parsetree.cmi parsing/longident.cmi parsing/location.cmi \
|
||||
typing/includemod.cmi typing/ident.cmi typing/env.cmi \
|
||||
|
@ -239,6 +239,12 @@ typing/datarepr.cmo : typing/types.cmi typing/path.cmi parsing/location.cmi \
|
|||
typing/datarepr.cmx : typing/types.cmx typing/path.cmx parsing/location.cmx \
|
||||
typing/ident.cmx typing/btype.cmx parsing/asttypes.cmi \
|
||||
typing/datarepr.cmi
|
||||
typing/envaux.cmo : typing/types.cmi typing/subst.cmi typing/printtyp.cmi \
|
||||
typing/path.cmi utils/misc.cmi typing/ident.cmi typing/env.cmi \
|
||||
parsing/asttypes.cmi typing/envaux.cmi
|
||||
typing/envaux.cmx : typing/types.cmx typing/subst.cmx typing/printtyp.cmx \
|
||||
typing/path.cmx utils/misc.cmx typing/ident.cmx typing/env.cmx \
|
||||
parsing/asttypes.cmi typing/envaux.cmi
|
||||
typing/env.cmo : utils/warnings.cmi typing/types.cmi utils/tbl.cmi \
|
||||
typing/subst.cmi typing/predef.cmi typing/path.cmi utils/misc.cmi \
|
||||
parsing/longident.cmi parsing/location.cmi typing/ident.cmi \
|
||||
|
@ -251,12 +257,6 @@ typing/env.cmx : utils/warnings.cmx typing/types.cmx utils/tbl.cmx \
|
|||
typing/datarepr.cmx utils/consistbl.cmx utils/config.cmx \
|
||||
typing/cmi_format.cmx utils/clflags.cmx parsing/builtin_attributes.cmx \
|
||||
typing/btype.cmx parsing/asttypes.cmi typing/env.cmi
|
||||
typing/envaux.cmo : typing/types.cmi typing/subst.cmi typing/printtyp.cmi \
|
||||
typing/path.cmi utils/misc.cmi typing/ident.cmi typing/env.cmi \
|
||||
parsing/asttypes.cmi typing/envaux.cmi
|
||||
typing/envaux.cmx : typing/types.cmx typing/subst.cmx typing/printtyp.cmx \
|
||||
typing/path.cmx utils/misc.cmx typing/ident.cmx typing/env.cmx \
|
||||
parsing/asttypes.cmi typing/envaux.cmi
|
||||
typing/ident.cmo : utils/identifiable.cmi typing/ident.cmi
|
||||
typing/ident.cmx : utils/identifiable.cmx typing/ident.cmi
|
||||
typing/includeclass.cmo : typing/types.cmi typing/printtyp.cmi \
|
||||
|
@ -321,6 +321,12 @@ typing/primitive.cmo : utils/warnings.cmi parsing/parsetree.cmi \
|
|||
typing/primitive.cmx : utils/warnings.cmx parsing/parsetree.cmi \
|
||||
typing/outcometree.cmi utils/misc.cmx parsing/location.cmx \
|
||||
parsing/attr_helper.cmx typing/primitive.cmi
|
||||
typing/printtyped.cmo : typing/typedtree.cmi parsing/printast.cmi \
|
||||
typing/path.cmi utils/misc.cmi parsing/longident.cmi parsing/location.cmi \
|
||||
typing/ident.cmi parsing/asttypes.cmi typing/printtyped.cmi
|
||||
typing/printtyped.cmx : typing/typedtree.cmx parsing/printast.cmx \
|
||||
typing/path.cmx utils/misc.cmx parsing/longident.cmx parsing/location.cmx \
|
||||
typing/ident.cmx parsing/asttypes.cmi typing/printtyped.cmi
|
||||
typing/printtyp.cmo : typing/types.cmi typing/primitive.cmi \
|
||||
typing/predef.cmi typing/path.cmi parsing/parsetree.cmi \
|
||||
typing/outcometree.cmi typing/oprint.cmi utils/misc.cmi \
|
||||
|
@ -333,12 +339,6 @@ typing/printtyp.cmx : typing/types.cmx typing/primitive.cmx \
|
|||
parsing/longident.cmx parsing/location.cmx typing/ident.cmx \
|
||||
typing/env.cmx typing/ctype.cmx utils/clflags.cmx typing/btype.cmx \
|
||||
parsing/asttypes.cmi typing/printtyp.cmi
|
||||
typing/printtyped.cmo : typing/typedtree.cmi parsing/printast.cmi \
|
||||
typing/path.cmi utils/misc.cmi parsing/longident.cmi parsing/location.cmi \
|
||||
typing/ident.cmi parsing/asttypes.cmi typing/printtyped.cmi
|
||||
typing/printtyped.cmx : typing/typedtree.cmx parsing/printast.cmx \
|
||||
typing/path.cmx utils/misc.cmx parsing/longident.cmx parsing/location.cmx \
|
||||
typing/ident.cmx parsing/asttypes.cmi typing/printtyped.cmi
|
||||
typing/stypes.cmo : typing/typedtree.cmi typing/printtyp.cmi \
|
||||
parsing/location.cmi utils/clflags.cmi typing/annot.cmi typing/stypes.cmi
|
||||
typing/stypes.cmx : typing/typedtree.cmx typing/printtyp.cmx \
|
||||
|
@ -407,14 +407,6 @@ typing/typedecl.cmx : utils/warnings.cmx typing/typetexp.cmx \
|
|||
utils/clflags.cmx typing/btype.cmx parsing/attr_helper.cmx \
|
||||
parsing/asttypes.cmi parsing/ast_iterator.cmx parsing/ast_helper.cmx \
|
||||
typing/typedecl.cmi
|
||||
typing/typedtree.cmo : typing/types.cmi typing/primitive.cmi typing/path.cmi \
|
||||
parsing/parsetree.cmi utils/misc.cmi parsing/longident.cmi \
|
||||
parsing/location.cmi typing/ident.cmi typing/env.cmi parsing/asttypes.cmi \
|
||||
typing/typedtree.cmi
|
||||
typing/typedtree.cmx : typing/types.cmx typing/primitive.cmx typing/path.cmx \
|
||||
parsing/parsetree.cmi utils/misc.cmx parsing/longident.cmx \
|
||||
parsing/location.cmx typing/ident.cmx typing/env.cmx parsing/asttypes.cmi \
|
||||
typing/typedtree.cmi
|
||||
typing/typedtreeIter.cmo : typing/typedtree.cmi utils/misc.cmi \
|
||||
parsing/asttypes.cmi typing/typedtreeIter.cmi
|
||||
typing/typedtreeIter.cmx : typing/typedtree.cmx utils/misc.cmx \
|
||||
|
@ -423,6 +415,14 @@ typing/typedtreeMap.cmo : typing/typedtree.cmi utils/misc.cmi \
|
|||
typing/typedtreeMap.cmi
|
||||
typing/typedtreeMap.cmx : typing/typedtree.cmx utils/misc.cmx \
|
||||
typing/typedtreeMap.cmi
|
||||
typing/typedtree.cmo : typing/types.cmi typing/primitive.cmi typing/path.cmi \
|
||||
parsing/parsetree.cmi utils/misc.cmi parsing/longident.cmi \
|
||||
parsing/location.cmi typing/ident.cmi typing/env.cmi parsing/asttypes.cmi \
|
||||
typing/typedtree.cmi
|
||||
typing/typedtree.cmx : typing/types.cmx typing/primitive.cmx typing/path.cmx \
|
||||
parsing/parsetree.cmi utils/misc.cmx parsing/longident.cmx \
|
||||
parsing/location.cmx typing/ident.cmx typing/env.cmx parsing/asttypes.cmi \
|
||||
typing/typedtree.cmi
|
||||
typing/typemod.cmo : utils/warnings.cmi typing/typetexp.cmi typing/types.cmi \
|
||||
typing/typedtree.cmi typing/typedecl.cmi typing/typecore.cmi \
|
||||
typing/typeclass.cmi typing/subst.cmi typing/stypes.cmi \
|
||||
|
@ -627,11 +627,13 @@ bytecomp/symtable.cmx : utils/tbl.cmx bytecomp/runtimedef.cmx \
|
|||
bytecomp/cmo_format.cmi utils/clflags.cmx bytecomp/bytesections.cmx \
|
||||
parsing/asttypes.cmi bytecomp/symtable.cmi
|
||||
bytecomp/translattribute.cmo : utils/warnings.cmi typing/typedtree.cmi \
|
||||
parsing/parsetree.cmi parsing/longident.cmi parsing/location.cmi \
|
||||
bytecomp/lambda.cmi bytecomp/translattribute.cmi
|
||||
parsing/parsetree.cmi utils/misc.cmi parsing/longident.cmi \
|
||||
parsing/location.cmi bytecomp/lambda.cmi utils/config.cmi \
|
||||
bytecomp/translattribute.cmi
|
||||
bytecomp/translattribute.cmx : utils/warnings.cmx typing/typedtree.cmx \
|
||||
parsing/parsetree.cmi parsing/longident.cmx parsing/location.cmx \
|
||||
bytecomp/lambda.cmx bytecomp/translattribute.cmi
|
||||
parsing/parsetree.cmi utils/misc.cmx parsing/longident.cmx \
|
||||
parsing/location.cmx bytecomp/lambda.cmx utils/config.cmx \
|
||||
bytecomp/translattribute.cmi
|
||||
bytecomp/translclass.cmo : typing/types.cmi bytecomp/typeopt.cmi \
|
||||
typing/typedtree.cmi bytecomp/translobj.cmi bytecomp/translcore.cmi \
|
||||
typing/path.cmi bytecomp/matching.cmi parsing/location.cmi \
|
||||
|
@ -684,7 +686,6 @@ bytecomp/typeopt.cmo : typing/types.cmi typing/typedtree.cmi \
|
|||
bytecomp/typeopt.cmx : typing/types.cmx typing/typedtree.cmx \
|
||||
typing/predef.cmx typing/path.cmx bytecomp/lambda.cmx typing/ident.cmx \
|
||||
typing/env.cmx typing/ctype.cmx bytecomp/typeopt.cmi
|
||||
asmcomp/CSEgen.cmi : asmcomp/mach.cmi
|
||||
asmcomp/asmgen.cmi : utils/timings.cmi bytecomp/lambda.cmi \
|
||||
middle_end/flambda.cmi asmcomp/cmm.cmi middle_end/backend_intf.cmi
|
||||
asmcomp/asmlibrarian.cmi :
|
||||
|
@ -699,10 +700,10 @@ asmcomp/clambda.cmi : bytecomp/lambda.cmi typing/ident.cmi \
|
|||
asmcomp/closure.cmi : bytecomp/lambda.cmi asmcomp/clambda.cmi
|
||||
asmcomp/closure_offsets.cmi : middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/flambda.cmi middle_end/base_types/closure_id.cmi
|
||||
asmcomp/cmm.cmi : bytecomp/lambda.cmi typing/ident.cmi \
|
||||
bytecomp/debuginfo.cmi
|
||||
asmcomp/cmmgen.cmi : asmcomp/cmx_format.cmi asmcomp/cmm.cmi \
|
||||
asmcomp/clambda.cmi
|
||||
asmcomp/cmm.cmi : bytecomp/lambda.cmi typing/ident.cmi \
|
||||
bytecomp/debuginfo.cmi
|
||||
asmcomp/cmx_format.cmi : asmcomp/export_info.cmi asmcomp/clambda.cmi
|
||||
asmcomp/coloring.cmi :
|
||||
asmcomp/comballoc.cmi : asmcomp/mach.cmi
|
||||
|
@ -712,9 +713,12 @@ asmcomp/compilenv.cmi : utils/timings.cmi middle_end/base_types/symbol.cmi \
|
|||
middle_end/flambda.cmi asmcomp/export_info.cmi \
|
||||
middle_end/base_types/compilation_unit.cmi asmcomp/cmx_format.cmi \
|
||||
middle_end/base_types/closure_id.cmi asmcomp/clambda.cmi
|
||||
asmcomp/CSEgen.cmi : asmcomp/mach.cmi
|
||||
asmcomp/deadcode.cmi : asmcomp/mach.cmi
|
||||
asmcomp/emit.cmi : asmcomp/linearize.cmi asmcomp/cmm.cmi
|
||||
asmcomp/emitaux.cmi : bytecomp/debuginfo.cmi
|
||||
asmcomp/emit.cmi : asmcomp/linearize.cmi asmcomp/cmm.cmi
|
||||
asmcomp/export_info_for_pack.cmi : asmcomp/export_info.cmi \
|
||||
middle_end/base_types/compilation_unit.cmi
|
||||
asmcomp/export_info.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
|
@ -723,8 +727,6 @@ asmcomp/export_info.cmi : middle_end/base_types/variable.cmi \
|
|||
middle_end/base_types/export_id.cmi \
|
||||
middle_end/base_types/compilation_unit.cmi \
|
||||
middle_end/base_types/closure_id.cmi
|
||||
asmcomp/export_info_for_pack.cmi : asmcomp/export_info.cmi \
|
||||
middle_end/base_types/compilation_unit.cmi
|
||||
asmcomp/flambda_to_clambda.cmi : middle_end/base_types/symbol.cmi \
|
||||
middle_end/flambda.cmi asmcomp/export_info.cmi asmcomp/clambda.cmi
|
||||
asmcomp/import_approx.cmi : middle_end/base_types/symbol.cmi \
|
||||
|
@ -741,8 +743,8 @@ asmcomp/printlinear.cmi : asmcomp/linearize.cmi
|
|||
asmcomp/printmach.cmi : asmcomp/reg.cmi asmcomp/mach.cmi
|
||||
asmcomp/proc.cmi : asmcomp/reg.cmi asmcomp/mach.cmi
|
||||
asmcomp/reg.cmi : typing/ident.cmi asmcomp/cmm.cmi
|
||||
asmcomp/reload.cmi : asmcomp/mach.cmi
|
||||
asmcomp/reloadgen.cmi : asmcomp/reg.cmi asmcomp/mach.cmi
|
||||
asmcomp/reload.cmi : asmcomp/mach.cmi
|
||||
asmcomp/schedgen.cmi : asmcomp/mach.cmi asmcomp/linearize.cmi
|
||||
asmcomp/scheduling.cmi : asmcomp/linearize.cmi
|
||||
asmcomp/selectgen.cmi : utils/tbl.cmi asmcomp/reg.cmi asmcomp/mach.cmi \
|
||||
|
@ -757,12 +759,6 @@ asmcomp/x86_dsl.cmi : asmcomp/x86_ast.cmi
|
|||
asmcomp/x86_gas.cmi : asmcomp/x86_ast.cmi
|
||||
asmcomp/x86_masm.cmi : asmcomp/x86_ast.cmi
|
||||
asmcomp/x86_proc.cmi : asmcomp/x86_ast.cmi
|
||||
asmcomp/CSE.cmo : asmcomp/mach.cmi asmcomp/CSEgen.cmi asmcomp/arch.cmo
|
||||
asmcomp/CSE.cmx : asmcomp/mach.cmx asmcomp/CSEgen.cmx asmcomp/arch.cmx
|
||||
asmcomp/CSEgen.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
|
||||
asmcomp/cmm.cmi asmcomp/CSEgen.cmi
|
||||
asmcomp/CSEgen.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \
|
||||
asmcomp/cmm.cmx asmcomp/CSEgen.cmi
|
||||
asmcomp/arch.cmo : utils/clflags.cmi
|
||||
asmcomp/arch.cmx : utils/clflags.cmx
|
||||
asmcomp/asmgen.cmo : asmcomp/un_anf.cmi bytecomp/translmod.cmi \
|
||||
|
@ -827,14 +823,14 @@ asmcomp/asmpackager.cmx : typing/typemod.cmx bytecomp/translmod.cmx \
|
|||
middle_end/base_types/compilation_unit.cmx asmcomp/cmx_format.cmi \
|
||||
utils/clflags.cmx utils/ccomp.cmx asmcomp/asmlink.cmx asmcomp/asmgen.cmx \
|
||||
asmcomp/asmpackager.cmi
|
||||
asmcomp/branch_relaxation_intf.cmo : asmcomp/linearize.cmi asmcomp/arch.cmo
|
||||
asmcomp/branch_relaxation_intf.cmx : asmcomp/linearize.cmx asmcomp/arch.cmx
|
||||
asmcomp/branch_relaxation.cmo : utils/misc.cmi asmcomp/mach.cmi \
|
||||
asmcomp/linearize.cmi asmcomp/cmm.cmi asmcomp/branch_relaxation_intf.cmo \
|
||||
asmcomp/branch_relaxation.cmi
|
||||
asmcomp/branch_relaxation.cmx : utils/misc.cmx asmcomp/mach.cmx \
|
||||
asmcomp/linearize.cmx asmcomp/cmm.cmx asmcomp/branch_relaxation_intf.cmx \
|
||||
asmcomp/branch_relaxation.cmi
|
||||
asmcomp/branch_relaxation_intf.cmo : asmcomp/linearize.cmi asmcomp/arch.cmo
|
||||
asmcomp/branch_relaxation_intf.cmx : asmcomp/linearize.cmx asmcomp/arch.cmx
|
||||
asmcomp/build_export_info.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
|
@ -881,10 +877,6 @@ asmcomp/closure_offsets.cmx : middle_end/base_types/variable.cmx \
|
|||
middle_end/flambda_utils.cmx middle_end/flambda_iterators.cmx \
|
||||
middle_end/flambda.cmx middle_end/base_types/closure_id.cmx \
|
||||
asmcomp/closure_offsets.cmi
|
||||
asmcomp/cmm.cmo : bytecomp/lambda.cmi typing/ident.cmi \
|
||||
bytecomp/debuginfo.cmi asmcomp/arch.cmo asmcomp/cmm.cmi
|
||||
asmcomp/cmm.cmx : bytecomp/lambda.cmx typing/ident.cmx \
|
||||
bytecomp/debuginfo.cmx asmcomp/arch.cmx asmcomp/cmm.cmi
|
||||
asmcomp/cmmgen.cmo : asmcomp/un_anf.cmi typing/types.cmi bytecomp/switch.cmi \
|
||||
asmcomp/strmatch.cmi asmcomp/proc.cmi bytecomp/printlambda.cmi \
|
||||
typing/primitive.cmi utils/misc.cmi bytecomp/lambda.cmi typing/ident.cmi \
|
||||
|
@ -899,6 +891,10 @@ asmcomp/cmmgen.cmx : asmcomp/un_anf.cmx typing/types.cmx bytecomp/switch.cmx \
|
|||
asmcomp/cmx_format.cmi asmcomp/cmm.cmx utils/clflags.cmx \
|
||||
asmcomp/clambda.cmx parsing/asttypes.cmi asmcomp/arch.cmx \
|
||||
asmcomp/cmmgen.cmi
|
||||
asmcomp/cmm.cmo : bytecomp/lambda.cmi typing/ident.cmi \
|
||||
bytecomp/debuginfo.cmi asmcomp/arch.cmo asmcomp/cmm.cmi
|
||||
asmcomp/cmm.cmx : bytecomp/lambda.cmx typing/ident.cmx \
|
||||
bytecomp/debuginfo.cmx asmcomp/arch.cmx asmcomp/cmm.cmi
|
||||
asmcomp/coloring.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/coloring.cmi
|
||||
asmcomp/coloring.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/coloring.cmi
|
||||
asmcomp/comballoc.cmo : asmcomp/reg.cmi asmcomp/mach.cmi utils/config.cmi \
|
||||
|
@ -921,10 +917,20 @@ asmcomp/compilenv.cmx : utils/warnings.cmx middle_end/base_types/symbol.cmx \
|
|||
middle_end/base_types/compilation_unit.cmx asmcomp/cmx_format.cmi \
|
||||
middle_end/base_types/closure_id.cmx asmcomp/clambda.cmx \
|
||||
asmcomp/compilenv.cmi
|
||||
asmcomp/CSEgen.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
|
||||
asmcomp/cmm.cmi asmcomp/CSEgen.cmi
|
||||
asmcomp/CSEgen.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \
|
||||
asmcomp/cmm.cmx asmcomp/CSEgen.cmi
|
||||
asmcomp/CSE.cmo : asmcomp/mach.cmi asmcomp/CSEgen.cmi asmcomp/arch.cmo
|
||||
asmcomp/CSE.cmx : asmcomp/mach.cmx asmcomp/CSEgen.cmx asmcomp/arch.cmx
|
||||
asmcomp/deadcode.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
|
||||
asmcomp/deadcode.cmi
|
||||
asmcomp/deadcode.cmx : asmcomp/reg.cmx asmcomp/proc.cmx asmcomp/mach.cmx \
|
||||
asmcomp/deadcode.cmi
|
||||
asmcomp/emitaux.cmo : asmcomp/linearize.cmi bytecomp/debuginfo.cmi \
|
||||
utils/config.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/emitaux.cmi
|
||||
asmcomp/emitaux.cmx : asmcomp/linearize.cmx bytecomp/debuginfo.cmx \
|
||||
utils/config.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/emitaux.cmi
|
||||
asmcomp/emit.cmo : asmcomp/x86_proc.cmi asmcomp/x86_masm.cmi \
|
||||
asmcomp/x86_gas.cmi asmcomp/x86_dsl.cmi asmcomp/x86_ast.cmi \
|
||||
asmcomp/reg.cmi asmcomp/proc.cmi utils/misc.cmi asmcomp/mach.cmi \
|
||||
|
@ -939,26 +945,6 @@ asmcomp/emit.cmx : asmcomp/x86_proc.cmx asmcomp/x86_masm.cmx \
|
|||
bytecomp/debuginfo.cmx utils/config.cmx asmcomp/compilenv.cmx \
|
||||
asmcomp/cmm.cmx utils/clflags.cmx asmcomp/branch_relaxation.cmx \
|
||||
asmcomp/arch.cmx asmcomp/emit.cmi
|
||||
asmcomp/emitaux.cmo : asmcomp/linearize.cmi bytecomp/debuginfo.cmi \
|
||||
utils/config.cmi utils/clflags.cmi asmcomp/arch.cmo asmcomp/emitaux.cmi
|
||||
asmcomp/emitaux.cmx : asmcomp/linearize.cmx bytecomp/debuginfo.cmx \
|
||||
utils/config.cmx utils/clflags.cmx asmcomp/arch.cmx asmcomp/emitaux.cmi
|
||||
asmcomp/export_info.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
middle_end/simple_value_approx.cmi \
|
||||
middle_end/base_types/set_of_closures_id.cmi middle_end/flambda.cmi \
|
||||
middle_end/base_types/export_id.cmi \
|
||||
middle_end/base_types/compilation_unit.cmi \
|
||||
middle_end/base_types/closure_id.cmi asmcomp/export_info.cmi
|
||||
asmcomp/export_info.cmx : middle_end/base_types/variable.cmx \
|
||||
middle_end/base_types/var_within_closure.cmx \
|
||||
middle_end/base_types/tag.cmx middle_end/base_types/symbol.cmx \
|
||||
middle_end/simple_value_approx.cmx \
|
||||
middle_end/base_types/set_of_closures_id.cmx middle_end/flambda.cmx \
|
||||
middle_end/base_types/export_id.cmx \
|
||||
middle_end/base_types/compilation_unit.cmx \
|
||||
middle_end/base_types/closure_id.cmx asmcomp/export_info.cmi
|
||||
asmcomp/export_info_for_pack.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/base_types/symbol.cmi \
|
||||
|
@ -977,6 +963,22 @@ asmcomp/export_info_for_pack.cmx : middle_end/base_types/variable.cmx \
|
|||
middle_end/base_types/export_id.cmx \
|
||||
middle_end/base_types/compilation_unit.cmx \
|
||||
middle_end/base_types/closure_id.cmx asmcomp/export_info_for_pack.cmi
|
||||
asmcomp/export_info.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
middle_end/simple_value_approx.cmi \
|
||||
middle_end/base_types/set_of_closures_id.cmi middle_end/flambda.cmi \
|
||||
middle_end/base_types/export_id.cmi \
|
||||
middle_end/base_types/compilation_unit.cmi \
|
||||
middle_end/base_types/closure_id.cmi asmcomp/export_info.cmi
|
||||
asmcomp/export_info.cmx : middle_end/base_types/variable.cmx \
|
||||
middle_end/base_types/var_within_closure.cmx \
|
||||
middle_end/base_types/tag.cmx middle_end/base_types/symbol.cmx \
|
||||
middle_end/simple_value_approx.cmx \
|
||||
middle_end/base_types/set_of_closures_id.cmx middle_end/flambda.cmx \
|
||||
middle_end/base_types/export_id.cmx \
|
||||
middle_end/base_types/compilation_unit.cmx \
|
||||
middle_end/base_types/closure_id.cmx asmcomp/export_info.cmi
|
||||
asmcomp/flambda_to_clambda.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
|
@ -1069,14 +1071,14 @@ asmcomp/proc.cmx : asmcomp/x86_proc.cmx asmcomp/reg.cmx utils/misc.cmx \
|
|||
asmcomp/proc.cmi
|
||||
asmcomp/reg.cmo : typing/ident.cmi asmcomp/cmm.cmi asmcomp/reg.cmi
|
||||
asmcomp/reg.cmx : typing/ident.cmx asmcomp/cmm.cmx asmcomp/reg.cmi
|
||||
asmcomp/reload.cmo : asmcomp/reloadgen.cmi asmcomp/reg.cmi asmcomp/mach.cmi \
|
||||
asmcomp/cmm.cmi utils/clflags.cmi asmcomp/reload.cmi
|
||||
asmcomp/reload.cmx : asmcomp/reloadgen.cmx asmcomp/reg.cmx asmcomp/mach.cmx \
|
||||
asmcomp/cmm.cmx utils/clflags.cmx asmcomp/reload.cmi
|
||||
asmcomp/reloadgen.cmo : asmcomp/reg.cmi utils/misc.cmi asmcomp/mach.cmi \
|
||||
asmcomp/reloadgen.cmi
|
||||
asmcomp/reloadgen.cmx : asmcomp/reg.cmx utils/misc.cmx asmcomp/mach.cmx \
|
||||
asmcomp/reloadgen.cmi
|
||||
asmcomp/reload.cmo : asmcomp/reloadgen.cmi asmcomp/reg.cmi asmcomp/mach.cmi \
|
||||
asmcomp/cmm.cmi utils/clflags.cmi asmcomp/reload.cmi
|
||||
asmcomp/reload.cmx : asmcomp/reloadgen.cmx asmcomp/reg.cmx asmcomp/mach.cmx \
|
||||
asmcomp/cmm.cmx utils/clflags.cmx asmcomp/reload.cmi
|
||||
asmcomp/schedgen.cmo : asmcomp/reg.cmi asmcomp/proc.cmi asmcomp/mach.cmi \
|
||||
asmcomp/linearize.cmi asmcomp/cmm.cmi asmcomp/arch.cmo \
|
||||
asmcomp/schedgen.cmi
|
||||
|
@ -1146,19 +1148,22 @@ middle_end/augment_specialised_args.cmi : middle_end/base_types/variable.cmi \
|
|||
middle_end/backend_intf.cmi : middle_end/base_types/symbol.cmi \
|
||||
middle_end/simple_value_approx.cmi typing/ident.cmi \
|
||||
middle_end/base_types/closure_id.cmi
|
||||
middle_end/closure_conversion.cmi : bytecomp/lambda.cmi typing/ident.cmi \
|
||||
middle_end/flambda.cmi middle_end/backend_intf.cmi
|
||||
middle_end/closure_conversion_aux.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/symbol.cmi \
|
||||
middle_end/base_types/static_exception.cmi \
|
||||
middle_end/base_types/mutable_variable.cmi bytecomp/lambda.cmi \
|
||||
typing/ident.cmi
|
||||
middle_end/closure_conversion.cmi : bytecomp/lambda.cmi typing/ident.cmi \
|
||||
middle_end/flambda.cmi middle_end/backend_intf.cmi
|
||||
middle_end/effect_analysis.cmi : middle_end/flambda.cmi
|
||||
middle_end/extract_projections.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/projection.cmi middle_end/inline_and_simplify_aux.cmi \
|
||||
middle_end/flambda.cmi
|
||||
middle_end/find_recursive_functions.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/flambda.cmi middle_end/backend_intf.cmi
|
||||
middle_end/flambda_invariants.cmi : middle_end/flambda.cmi
|
||||
middle_end/flambda_iterators.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/symbol.cmi middle_end/flambda.cmi
|
||||
middle_end/flambda.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
middle_end/base_types/static_exception.cmi \
|
||||
|
@ -1168,9 +1173,6 @@ middle_end/flambda.cmi : middle_end/base_types/variable.cmi \
|
|||
bytecomp/lambda.cmi utils/identifiable.cmi bytecomp/debuginfo.cmi \
|
||||
middle_end/base_types/closure_id.cmi parsing/asttypes.cmi \
|
||||
middle_end/allocated_const.cmi
|
||||
middle_end/flambda_invariants.cmi : middle_end/flambda.cmi
|
||||
middle_end/flambda_iterators.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/symbol.cmi middle_end/flambda.cmi
|
||||
middle_end/flambda_utils.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
|
@ -1188,8 +1190,6 @@ middle_end/inconstant_idents.cmi : middle_end/base_types/variable.cmi \
|
|||
middle_end/base_types/set_of_closures_id.cmi middle_end/flambda.cmi \
|
||||
middle_end/base_types/compilation_unit.cmi middle_end/backend_intf.cmi
|
||||
middle_end/initialize_symbol_to_let_symbol.cmi : middle_end/flambda.cmi
|
||||
middle_end/inline_and_simplify.cmi : middle_end/flambda.cmi \
|
||||
middle_end/backend_intf.cmi
|
||||
middle_end/inline_and_simplify_aux.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/symbol.cmi \
|
||||
middle_end/base_types/static_exception.cmi \
|
||||
|
@ -1197,19 +1197,22 @@ middle_end/inline_and_simplify_aux.cmi : middle_end/base_types/variable.cmi \
|
|||
middle_end/base_types/set_of_closures_origin.cmi \
|
||||
middle_end/projection.cmi middle_end/base_types/mutable_variable.cmi \
|
||||
middle_end/inlining_stats_types.cmi middle_end/inlining_cost.cmi \
|
||||
middle_end/freshening.cmi bytecomp/debuginfo.cmi \
|
||||
middle_end/freshening.cmi middle_end/flambda.cmi bytecomp/debuginfo.cmi \
|
||||
middle_end/base_types/closure_id.cmi middle_end/backend_intf.cmi
|
||||
middle_end/inline_and_simplify.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/inline_and_simplify_aux.cmi middle_end/flambda.cmi \
|
||||
middle_end/backend_intf.cmi
|
||||
middle_end/inlining_cost.cmi : middle_end/projection.cmi \
|
||||
middle_end/flambda.cmi
|
||||
middle_end/inlining_decision_intf.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/simple_value_approx.cmi middle_end/inline_and_simplify_aux.cmi \
|
||||
middle_end/flambda.cmi bytecomp/debuginfo.cmi \
|
||||
middle_end/base_types/closure_id.cmi
|
||||
middle_end/inlining_decision.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/simple_value_approx.cmi bytecomp/lambda.cmi \
|
||||
middle_end/inlining_decision_intf.cmi \
|
||||
middle_end/inline_and_simplify_aux.cmi middle_end/flambda.cmi \
|
||||
bytecomp/debuginfo.cmi middle_end/base_types/closure_id.cmi
|
||||
middle_end/inlining_decision_intf.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/simple_value_approx.cmi middle_end/inline_and_simplify_aux.cmi \
|
||||
middle_end/flambda.cmi bytecomp/debuginfo.cmi \
|
||||
middle_end/base_types/closure_id.cmi
|
||||
middle_end/inlining_stats.cmi : middle_end/inlining_stats_types.cmi \
|
||||
bytecomp/debuginfo.cmi middle_end/base_types/closure_id.cmi
|
||||
middle_end/inlining_stats_types.cmi : middle_end/inlining_cost.cmi
|
||||
|
@ -1245,23 +1248,25 @@ middle_end/simple_value_approx.cmi : middle_end/base_types/variable.cmi \
|
|||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
middle_end/freshening.cmi middle_end/flambda.cmi \
|
||||
middle_end/base_types/export_id.cmi middle_end/base_types/closure_id.cmi
|
||||
middle_end/simplify_boxed_integer_ops.cmi : \
|
||||
middle_end/simplify_boxed_integer_ops_intf.cmi
|
||||
middle_end/simplify_boxed_integer_ops_intf.cmi : \
|
||||
middle_end/simple_value_approx.cmi bytecomp/lambda.cmi \
|
||||
middle_end/inlining_cost.cmi middle_end/flambda.cmi
|
||||
middle_end/simplify_boxed_integer_ops.cmi : \
|
||||
middle_end/simplify_boxed_integer_ops_intf.cmi
|
||||
middle_end/simplify_common.cmi : middle_end/simple_value_approx.cmi \
|
||||
bytecomp/lambda.cmi middle_end/inlining_cost.cmi middle_end/flambda.cmi
|
||||
middle_end/simplify_primitives.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/simple_value_approx.cmi bytecomp/lambda.cmi \
|
||||
middle_end/inlining_cost.cmi middle_end/flambda.cmi \
|
||||
bytecomp/debuginfo.cmi
|
||||
middle_end/unbox_closures.cmi : middle_end/inlining_cost.cmi \
|
||||
middle_end/inline_and_simplify_aux.cmi middle_end/flambda.cmi
|
||||
middle_end/unbox_closures.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/inlining_cost.cmi middle_end/inline_and_simplify_aux.cmi \
|
||||
middle_end/flambda.cmi
|
||||
middle_end/unbox_free_vars_of_closures.cmi : middle_end/inlining_cost.cmi \
|
||||
middle_end/inline_and_simplify_aux.cmi middle_end/flambda.cmi
|
||||
middle_end/unbox_specialised_args.cmi : middle_end/inlining_cost.cmi \
|
||||
middle_end/inline_and_simplify_aux.cmi middle_end/flambda.cmi
|
||||
middle_end/unbox_specialised_args.cmi : middle_end/base_types/variable.cmi \
|
||||
middle_end/inlining_cost.cmi middle_end/inline_and_simplify_aux.cmi \
|
||||
middle_end/flambda.cmi
|
||||
middle_end/alias_analysis.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
|
@ -1292,6 +1297,18 @@ middle_end/augment_specialised_args.cmx : middle_end/base_types/variable.cmx \
|
|||
bytecomp/debuginfo.cmx middle_end/base_types/closure_id.cmx \
|
||||
utils/clflags.cmx middle_end/backend_intf.cmi \
|
||||
middle_end/augment_specialised_args.cmi
|
||||
middle_end/closure_conversion_aux.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/symbol.cmi \
|
||||
middle_end/base_types/static_exception.cmi typing/primitive.cmi \
|
||||
utils/numbers.cmi middle_end/base_types/mutable_variable.cmi \
|
||||
utils/misc.cmi bytecomp/lambda.cmi typing/ident.cmi \
|
||||
middle_end/closure_conversion_aux.cmi
|
||||
middle_end/closure_conversion_aux.cmx : middle_end/base_types/variable.cmx \
|
||||
middle_end/base_types/symbol.cmx \
|
||||
middle_end/base_types/static_exception.cmx typing/primitive.cmx \
|
||||
utils/numbers.cmx middle_end/base_types/mutable_variable.cmx \
|
||||
utils/misc.cmx bytecomp/lambda.cmx typing/ident.cmx \
|
||||
middle_end/closure_conversion_aux.cmi
|
||||
middle_end/closure_conversion.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
middle_end/base_types/static_exception.cmi bytecomp/simplif.cmi \
|
||||
|
@ -1320,18 +1337,6 @@ middle_end/closure_conversion.cmx : middle_end/base_types/variable.cmx \
|
|||
middle_end/closure_conversion_aux.cmx utils/clflags.cmx \
|
||||
middle_end/backend_intf.cmi parsing/asttypes.cmi \
|
||||
middle_end/closure_conversion.cmi
|
||||
middle_end/closure_conversion_aux.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/symbol.cmi \
|
||||
middle_end/base_types/static_exception.cmi typing/primitive.cmi \
|
||||
utils/numbers.cmi middle_end/base_types/mutable_variable.cmi \
|
||||
utils/misc.cmi bytecomp/lambda.cmi typing/ident.cmi \
|
||||
middle_end/closure_conversion_aux.cmi
|
||||
middle_end/closure_conversion_aux.cmx : middle_end/base_types/variable.cmx \
|
||||
middle_end/base_types/symbol.cmx \
|
||||
middle_end/base_types/static_exception.cmx typing/primitive.cmx \
|
||||
utils/numbers.cmx middle_end/base_types/mutable_variable.cmx \
|
||||
utils/misc.cmx bytecomp/lambda.cmx typing/ident.cmx \
|
||||
middle_end/closure_conversion_aux.cmi
|
||||
middle_end/effect_analysis.cmo : middle_end/semantics_of_primitives.cmi \
|
||||
utils/misc.cmi bytecomp/lambda.cmi middle_end/flambda.cmi \
|
||||
middle_end/effect_analysis.cmi
|
||||
|
@ -1356,30 +1361,6 @@ middle_end/find_recursive_functions.cmo : middle_end/base_types/variable.cmi \
|
|||
middle_end/find_recursive_functions.cmx : middle_end/base_types/variable.cmx \
|
||||
utils/strongly_connected_components.cmx middle_end/flambda_utils.cmx \
|
||||
middle_end/flambda.cmx middle_end/find_recursive_functions.cmi
|
||||
middle_end/flambda.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
middle_end/base_types/static_exception.cmi \
|
||||
middle_end/base_types/set_of_closures_origin.cmi \
|
||||
middle_end/base_types/set_of_closures_id.cmi middle_end/projection.cmi \
|
||||
bytecomp/printlambda.cmi utils/numbers.cmi \
|
||||
middle_end/base_types/mutable_variable.cmi utils/misc.cmi \
|
||||
bytecomp/lambda.cmi utils/identifiable.cmi bytecomp/debuginfo.cmi \
|
||||
middle_end/base_types/compilation_unit.cmi \
|
||||
middle_end/base_types/closure_id.cmi utils/clflags.cmi \
|
||||
parsing/asttypes.cmi middle_end/allocated_const.cmi \
|
||||
middle_end/flambda.cmi
|
||||
middle_end/flambda.cmx : middle_end/base_types/variable.cmx \
|
||||
middle_end/base_types/tag.cmx middle_end/base_types/symbol.cmx \
|
||||
middle_end/base_types/static_exception.cmx \
|
||||
middle_end/base_types/set_of_closures_origin.cmx \
|
||||
middle_end/base_types/set_of_closures_id.cmx middle_end/projection.cmx \
|
||||
bytecomp/printlambda.cmx utils/numbers.cmx \
|
||||
middle_end/base_types/mutable_variable.cmx utils/misc.cmx \
|
||||
bytecomp/lambda.cmx utils/identifiable.cmx bytecomp/debuginfo.cmx \
|
||||
middle_end/base_types/compilation_unit.cmx \
|
||||
middle_end/base_types/closure_id.cmx utils/clflags.cmx \
|
||||
parsing/asttypes.cmi middle_end/allocated_const.cmx \
|
||||
middle_end/flambda.cmi
|
||||
middle_end/flambda_invariants.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
|
@ -1410,6 +1391,30 @@ middle_end/flambda_iterators.cmo : middle_end/base_types/variable.cmi \
|
|||
utils/misc.cmi middle_end/flambda.cmi middle_end/flambda_iterators.cmi
|
||||
middle_end/flambda_iterators.cmx : middle_end/base_types/variable.cmx \
|
||||
utils/misc.cmx middle_end/flambda.cmx middle_end/flambda_iterators.cmi
|
||||
middle_end/flambda.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/tag.cmi middle_end/base_types/symbol.cmi \
|
||||
middle_end/base_types/static_exception.cmi \
|
||||
middle_end/base_types/set_of_closures_origin.cmi \
|
||||
middle_end/base_types/set_of_closures_id.cmi middle_end/projection.cmi \
|
||||
bytecomp/printlambda.cmi utils/numbers.cmi \
|
||||
middle_end/base_types/mutable_variable.cmi utils/misc.cmi \
|
||||
bytecomp/lambda.cmi utils/identifiable.cmi bytecomp/debuginfo.cmi \
|
||||
middle_end/base_types/compilation_unit.cmi \
|
||||
middle_end/base_types/closure_id.cmi utils/clflags.cmi \
|
||||
parsing/asttypes.cmi middle_end/allocated_const.cmi \
|
||||
middle_end/flambda.cmi
|
||||
middle_end/flambda.cmx : middle_end/base_types/variable.cmx \
|
||||
middle_end/base_types/tag.cmx middle_end/base_types/symbol.cmx \
|
||||
middle_end/base_types/static_exception.cmx \
|
||||
middle_end/base_types/set_of_closures_origin.cmx \
|
||||
middle_end/base_types/set_of_closures_id.cmx middle_end/projection.cmx \
|
||||
bytecomp/printlambda.cmx utils/numbers.cmx \
|
||||
middle_end/base_types/mutable_variable.cmx utils/misc.cmx \
|
||||
bytecomp/lambda.cmx utils/identifiable.cmx bytecomp/debuginfo.cmx \
|
||||
middle_end/base_types/compilation_unit.cmx \
|
||||
middle_end/base_types/closure_id.cmx utils/clflags.cmx \
|
||||
parsing/asttypes.cmi middle_end/allocated_const.cmx \
|
||||
middle_end/flambda.cmi
|
||||
middle_end/flambda_utils.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/base_types/symbol.cmi bytecomp/switch.cmi \
|
||||
|
@ -1470,6 +1475,32 @@ middle_end/initialize_symbol_to_let_symbol.cmo : \
|
|||
middle_end/initialize_symbol_to_let_symbol.cmx : \
|
||||
middle_end/base_types/variable.cmx utils/misc.cmx middle_end/flambda.cmx \
|
||||
middle_end/initialize_symbol_to_let_symbol.cmi
|
||||
middle_end/inline_and_simplify_aux.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
middle_end/base_types/symbol.cmi \
|
||||
middle_end/base_types/static_exception.cmi \
|
||||
middle_end/simple_value_approx.cmi \
|
||||
middle_end/base_types/set_of_closures_origin.cmi \
|
||||
middle_end/projection.cmi utils/numbers.cmi \
|
||||
middle_end/base_types/mutable_variable.cmi utils/misc.cmi \
|
||||
middle_end/inlining_stats.cmi middle_end/inlining_cost.cmi \
|
||||
middle_end/freshening.cmi middle_end/flambda.cmi \
|
||||
middle_end/base_types/compilation_unit.cmi \
|
||||
middle_end/base_types/closure_id.cmi utils/clflags.cmi \
|
||||
middle_end/backend_intf.cmi middle_end/inline_and_simplify_aux.cmi
|
||||
middle_end/inline_and_simplify_aux.cmx : middle_end/base_types/variable.cmx \
|
||||
middle_end/base_types/var_within_closure.cmx \
|
||||
middle_end/base_types/symbol.cmx \
|
||||
middle_end/base_types/static_exception.cmx \
|
||||
middle_end/simple_value_approx.cmx \
|
||||
middle_end/base_types/set_of_closures_origin.cmx \
|
||||
middle_end/projection.cmx utils/numbers.cmx \
|
||||
middle_end/base_types/mutable_variable.cmx utils/misc.cmx \
|
||||
middle_end/inlining_stats.cmx middle_end/inlining_cost.cmx \
|
||||
middle_end/freshening.cmx middle_end/flambda.cmx \
|
||||
middle_end/base_types/compilation_unit.cmx \
|
||||
middle_end/base_types/closure_id.cmx utils/clflags.cmx \
|
||||
middle_end/backend_intf.cmi middle_end/inline_and_simplify_aux.cmi
|
||||
middle_end/inline_and_simplify.cmo : utils/warnings.cmi \
|
||||
middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi \
|
||||
|
@ -1510,28 +1541,6 @@ middle_end/inline_and_simplify.cmx : utils/warnings.cmx \
|
|||
bytecomp/debuginfo.cmx middle_end/base_types/closure_id.cmx \
|
||||
utils/clflags.cmx middle_end/backend_intf.cmi \
|
||||
middle_end/allocated_const.cmx middle_end/inline_and_simplify.cmi
|
||||
middle_end/inline_and_simplify_aux.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/symbol.cmi \
|
||||
middle_end/base_types/static_exception.cmi \
|
||||
middle_end/simple_value_approx.cmi \
|
||||
middle_end/base_types/set_of_closures_origin.cmi \
|
||||
middle_end/projection.cmi utils/numbers.cmi \
|
||||
middle_end/base_types/mutable_variable.cmi utils/misc.cmi \
|
||||
middle_end/inlining_stats.cmi middle_end/inlining_cost.cmi \
|
||||
middle_end/freshening.cmi middle_end/base_types/compilation_unit.cmi \
|
||||
utils/clflags.cmi middle_end/backend_intf.cmi \
|
||||
middle_end/inline_and_simplify_aux.cmi
|
||||
middle_end/inline_and_simplify_aux.cmx : middle_end/base_types/variable.cmx \
|
||||
middle_end/base_types/symbol.cmx \
|
||||
middle_end/base_types/static_exception.cmx \
|
||||
middle_end/simple_value_approx.cmx \
|
||||
middle_end/base_types/set_of_closures_origin.cmx \
|
||||
middle_end/projection.cmx utils/numbers.cmx \
|
||||
middle_end/base_types/mutable_variable.cmx utils/misc.cmx \
|
||||
middle_end/inlining_stats.cmx middle_end/inlining_cost.cmx \
|
||||
middle_end/freshening.cmx middle_end/base_types/compilation_unit.cmx \
|
||||
utils/clflags.cmx middle_end/backend_intf.cmi \
|
||||
middle_end/inline_and_simplify_aux.cmi
|
||||
middle_end/inlining_cost.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/projection.cmi typing/primitive.cmi utils/misc.cmi \
|
||||
bytecomp/lambda.cmi middle_end/flambda_iterators.cmi \
|
||||
|
@ -1775,11 +1784,13 @@ middle_end/simplify_primitives.cmx : middle_end/base_types/tag.cmx \
|
|||
middle_end/inlining_cost.cmx middle_end/flambda.cmx utils/clflags.cmx \
|
||||
parsing/asttypes.cmi middle_end/simplify_primitives.cmi
|
||||
middle_end/unbox_closures.cmo : middle_end/base_types/variable.cmi \
|
||||
middle_end/inlining_cost.cmi middle_end/inline_and_simplify_aux.cmi \
|
||||
middle_end/flambda_utils.cmi middle_end/flambda_iterators.cmi \
|
||||
middle_end/flambda.cmi middle_end/base_types/closure_id.cmi \
|
||||
utils/clflags.cmi middle_end/augment_specialised_args.cmi \
|
||||
middle_end/unbox_closures.cmi
|
||||
middle_end/unbox_closures.cmx : middle_end/base_types/variable.cmx \
|
||||
middle_end/inlining_cost.cmx middle_end/inline_and_simplify_aux.cmx \
|
||||
middle_end/flambda_utils.cmx middle_end/flambda_iterators.cmx \
|
||||
middle_end/flambda.cmx middle_end/base_types/closure_id.cmx \
|
||||
utils/clflags.cmx middle_end/augment_specialised_args.cmx \
|
||||
|
@ -1831,10 +1842,10 @@ middle_end/base_types/static_exception.cmi : utils/identifiable.cmi
|
|||
middle_end/base_types/symbol.cmi : middle_end/base_types/linkage_name.cmi \
|
||||
utils/identifiable.cmi middle_end/base_types/compilation_unit.cmi
|
||||
middle_end/base_types/tag.cmi : utils/identifiable.cmi
|
||||
middle_end/base_types/var_within_closure.cmi : \
|
||||
middle_end/base_types/closure_element.cmi
|
||||
middle_end/base_types/variable.cmi : utils/identifiable.cmi typing/ident.cmi \
|
||||
middle_end/base_types/compilation_unit.cmi
|
||||
middle_end/base_types/var_within_closure.cmi : \
|
||||
middle_end/base_types/closure_element.cmi
|
||||
middle_end/base_types/closure_element.cmo : \
|
||||
middle_end/base_types/variable.cmi \
|
||||
middle_end/base_types/closure_element.cmi
|
||||
|
@ -1861,6 +1872,8 @@ middle_end/base_types/export_id.cmx : utils/identifiable.cmx \
|
|||
middle_end/base_types/id_types.cmx \
|
||||
middle_end/base_types/compilation_unit.cmx \
|
||||
middle_end/base_types/export_id.cmi
|
||||
middle_end/base_types/fully_qualified_id.cmo :
|
||||
middle_end/base_types/fully_qualified_id.cmx :
|
||||
middle_end/base_types/id_types.cmo : utils/identifiable.cmi \
|
||||
middle_end/base_types/id_types.cmi
|
||||
middle_end/base_types/id_types.cmx : utils/identifiable.cmx \
|
||||
|
@ -1905,24 +1918,24 @@ middle_end/base_types/tag.cmo : utils/numbers.cmi utils/misc.cmi \
|
|||
utils/identifiable.cmi middle_end/base_types/tag.cmi
|
||||
middle_end/base_types/tag.cmx : utils/numbers.cmx utils/misc.cmx \
|
||||
utils/identifiable.cmx middle_end/base_types/tag.cmi
|
||||
middle_end/base_types/var_within_closure.cmo : \
|
||||
middle_end/base_types/closure_element.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi
|
||||
middle_end/base_types/var_within_closure.cmx : \
|
||||
middle_end/base_types/closure_element.cmx \
|
||||
middle_end/base_types/var_within_closure.cmi
|
||||
middle_end/base_types/variable.cmo : utils/misc.cmi utils/identifiable.cmi \
|
||||
typing/ident.cmi middle_end/base_types/compilation_unit.cmi \
|
||||
middle_end/base_types/variable.cmi
|
||||
middle_end/base_types/variable.cmx : utils/misc.cmx utils/identifiable.cmx \
|
||||
typing/ident.cmx middle_end/base_types/compilation_unit.cmx \
|
||||
middle_end/base_types/variable.cmi
|
||||
middle_end/base_types/var_within_closure.cmo : \
|
||||
middle_end/base_types/closure_element.cmi \
|
||||
middle_end/base_types/var_within_closure.cmi
|
||||
middle_end/base_types/var_within_closure.cmx : \
|
||||
middle_end/base_types/closure_element.cmx \
|
||||
middle_end/base_types/var_within_closure.cmi
|
||||
driver/compenv.cmi :
|
||||
driver/compile.cmi :
|
||||
driver/compmisc.cmi : typing/env.cmi
|
||||
driver/errors.cmi :
|
||||
driver/main.cmi :
|
||||
driver/main_args.cmi :
|
||||
driver/main.cmi :
|
||||
driver/optcompile.cmi : middle_end/backend_intf.cmi
|
||||
driver/opterrors.cmi :
|
||||
driver/optmain.cmi :
|
||||
|
@ -1959,6 +1972,10 @@ driver/compmisc.cmx : typing/typemod.cmx utils/misc.cmx \
|
|||
parsing/asttypes.cmi driver/compmisc.cmi
|
||||
driver/errors.cmo : parsing/location.cmi driver/errors.cmi
|
||||
driver/errors.cmx : parsing/location.cmx driver/errors.cmi
|
||||
driver/main_args.cmo : utils/warnings.cmi utils/clflags.cmi \
|
||||
driver/main_args.cmi
|
||||
driver/main_args.cmx : utils/warnings.cmx utils/clflags.cmx \
|
||||
driver/main_args.cmi
|
||||
driver/main.cmo : utils/warnings.cmi utils/timings.cmi utils/misc.cmi \
|
||||
driver/main_args.cmi parsing/location.cmi utils/config.cmi \
|
||||
driver/compmisc.cmi driver/compile.cmi driver/compenv.cmi \
|
||||
|
@ -1969,10 +1986,6 @@ driver/main.cmx : utils/warnings.cmx utils/timings.cmx utils/misc.cmx \
|
|||
driver/compmisc.cmx driver/compile.cmx driver/compenv.cmx \
|
||||
utils/clflags.cmx bytecomp/bytepackager.cmx bytecomp/bytelink.cmx \
|
||||
bytecomp/bytelibrarian.cmx driver/main.cmi
|
||||
driver/main_args.cmo : utils/warnings.cmi utils/clflags.cmi \
|
||||
driver/main_args.cmi
|
||||
driver/main_args.cmx : utils/warnings.cmx utils/clflags.cmx \
|
||||
driver/main_args.cmi
|
||||
driver/optcompile.cmo : utils/warnings.cmi typing/typemod.cmi \
|
||||
typing/typedtree.cmi typing/typecore.cmi bytecomp/translmod.cmi \
|
||||
utils/timings.cmi typing/stypes.cmi bytecomp/simplif.cmi \
|
||||
|
@ -2056,31 +2069,33 @@ toplevel/opttopdirs.cmx : utils/warnings.cmx typing/types.cmx \
|
|||
toplevel/opttoploop.cmo : utils/warnings.cmi typing/types.cmi \
|
||||
typing/typemod.cmi typing/typedtree.cmi typing/typecore.cmi \
|
||||
bytecomp/translmod.cmi utils/timings.cmi bytecomp/simplif.cmi \
|
||||
typing/printtyped.cmi typing/printtyp.cmi bytecomp/printlambda.cmi \
|
||||
parsing/printast.cmi typing/predef.cmi parsing/pprintast.cmi \
|
||||
driver/pparse.cmi typing/path.cmi parsing/parsetree.cmi parsing/parse.cmi \
|
||||
typing/outcometree.cmi typing/oprint.cmi utils/misc.cmi \
|
||||
middle_end/middle_end.cmi parsing/longident.cmi parsing/location.cmi \
|
||||
parsing/lexer.cmi bytecomp/lambda.cmi typing/includemod.cmi \
|
||||
asmcomp/import_approx.cmi typing/ident.cmi toplevel/genprintval.cmi \
|
||||
typing/env.cmi utils/config.cmi driver/compmisc.cmi asmcomp/compilenv.cmi \
|
||||
utils/clflags.cmi typing/btype.cmi middle_end/backend_intf.cmi \
|
||||
parsing/asttypes.cmi parsing/ast_helper.cmi asmcomp/asmlink.cmi \
|
||||
asmcomp/asmgen.cmi asmcomp/arch.cmo toplevel/opttoploop.cmi
|
||||
asmcomp/proc.cmi typing/printtyped.cmi typing/printtyp.cmi \
|
||||
bytecomp/printlambda.cmi parsing/printast.cmi typing/predef.cmi \
|
||||
parsing/pprintast.cmi driver/pparse.cmi typing/path.cmi \
|
||||
parsing/parsetree.cmi parsing/parse.cmi typing/outcometree.cmi \
|
||||
typing/oprint.cmi utils/misc.cmi middle_end/middle_end.cmi \
|
||||
parsing/longident.cmi parsing/location.cmi parsing/lexer.cmi \
|
||||
bytecomp/lambda.cmi typing/includemod.cmi asmcomp/import_approx.cmi \
|
||||
typing/ident.cmi toplevel/genprintval.cmi typing/env.cmi utils/config.cmi \
|
||||
driver/compmisc.cmi asmcomp/compilenv.cmi utils/clflags.cmi \
|
||||
typing/btype.cmi middle_end/backend_intf.cmi parsing/asttypes.cmi \
|
||||
parsing/ast_helper.cmi asmcomp/asmlink.cmi asmcomp/asmgen.cmi \
|
||||
asmcomp/arch.cmo toplevel/opttoploop.cmi
|
||||
toplevel/opttoploop.cmx : utils/warnings.cmx typing/types.cmx \
|
||||
typing/typemod.cmx typing/typedtree.cmx typing/typecore.cmx \
|
||||
bytecomp/translmod.cmx utils/timings.cmx bytecomp/simplif.cmx \
|
||||
typing/printtyped.cmx typing/printtyp.cmx bytecomp/printlambda.cmx \
|
||||
parsing/printast.cmx typing/predef.cmx parsing/pprintast.cmx \
|
||||
driver/pparse.cmx typing/path.cmx parsing/parsetree.cmi parsing/parse.cmx \
|
||||
typing/outcometree.cmi typing/oprint.cmx utils/misc.cmx \
|
||||
middle_end/middle_end.cmx parsing/longident.cmx parsing/location.cmx \
|
||||
parsing/lexer.cmx bytecomp/lambda.cmx typing/includemod.cmx \
|
||||
asmcomp/import_approx.cmx typing/ident.cmx toplevel/genprintval.cmx \
|
||||
typing/env.cmx utils/config.cmx driver/compmisc.cmx asmcomp/compilenv.cmx \
|
||||
utils/clflags.cmx typing/btype.cmx middle_end/backend_intf.cmi \
|
||||
parsing/asttypes.cmi parsing/ast_helper.cmx asmcomp/asmlink.cmx \
|
||||
asmcomp/asmgen.cmx asmcomp/arch.cmx toplevel/opttoploop.cmi
|
||||
asmcomp/proc.cmx typing/printtyped.cmx typing/printtyp.cmx \
|
||||
bytecomp/printlambda.cmx parsing/printast.cmx typing/predef.cmx \
|
||||
parsing/pprintast.cmx driver/pparse.cmx typing/path.cmx \
|
||||
parsing/parsetree.cmi parsing/parse.cmx typing/outcometree.cmi \
|
||||
typing/oprint.cmx utils/misc.cmx middle_end/middle_end.cmx \
|
||||
parsing/longident.cmx parsing/location.cmx parsing/lexer.cmx \
|
||||
bytecomp/lambda.cmx typing/includemod.cmx asmcomp/import_approx.cmx \
|
||||
typing/ident.cmx toplevel/genprintval.cmx typing/env.cmx utils/config.cmx \
|
||||
driver/compmisc.cmx asmcomp/compilenv.cmx utils/clflags.cmx \
|
||||
typing/btype.cmx middle_end/backend_intf.cmi parsing/asttypes.cmi \
|
||||
parsing/ast_helper.cmx asmcomp/asmlink.cmx asmcomp/asmgen.cmx \
|
||||
asmcomp/arch.cmx toplevel/opttoploop.cmi
|
||||
toplevel/opttopmain.cmo : utils/warnings.cmi asmcomp/printmach.cmi \
|
||||
toplevel/opttoploop.cmi toplevel/opttopdirs.cmi utils/misc.cmi \
|
||||
driver/main_args.cmi parsing/location.cmi utils/config.cmi \
|
||||
|
|
|
@ -91,6 +91,7 @@ let rec import_ex ex =
|
|||
~invariant_params:(lazy invariant_params)
|
||||
~specialised_args:Variable.Map.empty
|
||||
~freshening:Freshening.Project_var.empty
|
||||
~direct_call_surrogates:Closure_id.Map.empty
|
||||
in
|
||||
match Export_info.find_description ex_info ex with
|
||||
| exception Not_found -> A.value_unknown Other
|
||||
|
|
BIN
boot/ocamlc
BIN
boot/ocamlc
Binary file not shown.
BIN
boot/ocamldep
BIN
boot/ocamldep
Binary file not shown.
BIN
boot/ocamllex
BIN
boot/ocamllex
Binary file not shown.
|
@ -308,6 +308,8 @@ let read_one_param ppf position name v =
|
|||
end
|
||||
| "unbox-closures" ->
|
||||
set "unbox-closures" [ unbox_closures ] v
|
||||
| "unbox-closures-factor" ->
|
||||
int_setter ppf "unbox-closures-factor" unbox_closures_factor v
|
||||
| "remove-unused-arguments" ->
|
||||
set "remove-unused-arguments" [ remove_unused_arguments ] v
|
||||
|
||||
|
|
|
@ -424,6 +424,14 @@ let mk_unbox_closures f =
|
|||
" Pass free variables via specialised arguments rather than closures"
|
||||
;;
|
||||
|
||||
let mk_unbox_closures_factor f =
|
||||
"-unbox-closures-factor", Arg.Int f,
|
||||
Printf.sprintf "<n > 0> Scale the size threshold above which \
|
||||
unbox-closures will slow down indirect calls rather than duplicating a \
|
||||
function (default %d)"
|
||||
Clflags.default_unbox_closures_factor
|
||||
;;
|
||||
|
||||
let mk_unsafe f =
|
||||
"-unsafe", Arg.Unit f,
|
||||
" Do not compile bounds checking on array and string access"
|
||||
|
@ -772,6 +780,7 @@ module type Optcommon_options = sig
|
|||
val _inline_indirect_cost : string -> unit
|
||||
val _inline_lifting_benefit : string -> unit
|
||||
val _unbox_closures : unit -> unit
|
||||
val _unbox_closures_factor : int -> unit
|
||||
val _inline_branch_factor : string -> unit
|
||||
val _remove_unused_arguments : unit -> unit
|
||||
val _no_unbox_free_vars_of_closures : unit -> unit
|
||||
|
@ -1046,6 +1055,7 @@ struct
|
|||
mk_strict_formats F._strict_formats;
|
||||
mk_thread F._thread;
|
||||
mk_unbox_closures F._unbox_closures;
|
||||
mk_unbox_closures_factor F._unbox_closures_factor;
|
||||
mk_inline_max_unroll F._inline_max_unroll;
|
||||
mk_unsafe F._unsafe;
|
||||
mk_unsafe_string F._unsafe_string;
|
||||
|
@ -1136,6 +1146,7 @@ module Make_opttop_options (F : Opttop_options) = struct
|
|||
mk_strict_sequence F._strict_sequence;
|
||||
mk_strict_formats F._strict_formats;
|
||||
mk_unbox_closures F._unbox_closures;
|
||||
mk_unbox_closures_factor F._unbox_closures_factor;
|
||||
mk_unsafe F._unsafe;
|
||||
mk_unsafe_string F._unsafe_string;
|
||||
mk_version F._version;
|
||||
|
|
|
@ -136,6 +136,7 @@ module type Optcommon_options = sig
|
|||
val _inline_indirect_cost : string -> unit
|
||||
val _inline_lifting_benefit : string -> unit
|
||||
val _unbox_closures : unit -> unit
|
||||
val _unbox_closures_factor : int -> unit
|
||||
val _inline_branch_factor : string -> unit
|
||||
val _remove_unused_arguments : unit -> unit
|
||||
val _no_unbox_free_vars_of_closures : unit -> unit
|
||||
|
|
|
@ -199,6 +199,7 @@ module Options = Main_args.Make_optcomp_options (struct
|
|||
let _S = set keep_asm_file
|
||||
let _thread = set use_threads
|
||||
let _unbox_closures = set unbox_closures
|
||||
let _unbox_closures_factor f = unbox_closures_factor := f
|
||||
let _unsafe = set fast
|
||||
let _unsafe_string = set unsafe_string
|
||||
let _v () = print_version_and_library "native-code compiler"
|
||||
|
|
|
@ -61,11 +61,13 @@ module What_to_specialise = struct
|
|||
(* [definitions] is indexed by (fun_var, group) *)
|
||||
definitions : Definition.t list Variable.Pair.Map.t;
|
||||
set_of_closures : Flambda.set_of_closures;
|
||||
make_direct_call_surrogates_for : Variable.Set.t;
|
||||
}
|
||||
|
||||
let create ~set_of_closures =
|
||||
{ definitions = Variable.Pair.Map.empty;
|
||||
set_of_closures;
|
||||
make_direct_call_surrogates_for = Variable.Set.empty;
|
||||
}
|
||||
|
||||
let new_specialised_arg t ~fun_var ~group ~definition =
|
||||
|
@ -80,6 +82,18 @@ module What_to_specialise = struct
|
|||
t.definitions
|
||||
in
|
||||
{ t with definitions; }
|
||||
|
||||
let make_direct_call_surrogate_for t ~fun_var =
|
||||
match Variable.Map.find fun_var t.set_of_closures.function_decls.funs with
|
||||
| exception Not_found ->
|
||||
Misc.fatal_errorf "use_direct_call_surrogate_for: %a is not a fun_var \
|
||||
from the given set of closures"
|
||||
Variable.print fun_var
|
||||
| _ ->
|
||||
{ t with
|
||||
make_direct_call_surrogates_for =
|
||||
Variable.Set.add fun_var t.make_direct_call_surrogates_for;
|
||||
}
|
||||
end
|
||||
|
||||
module W = What_to_specialise
|
||||
|
@ -98,6 +112,7 @@ module Processed_what_to_specialise = struct
|
|||
type for_one_function = {
|
||||
fun_var : Variable.t;
|
||||
function_decl : Flambda.function_declaration;
|
||||
make_direct_call_surrogates : bool;
|
||||
new_definitions_indexed_by_new_inner_vars : Definition.t Variable.Map.t;
|
||||
all_new_definitions : Definition.Set.t;
|
||||
new_inner_to_new_outer_vars : Variable.t Variable.Map.t;
|
||||
|
@ -116,6 +131,7 @@ module Processed_what_to_specialise = struct
|
|||
new_lifted_defns_indexed_by_new_outer_vars : Projection.t Variable.Map.t;
|
||||
new_outer_vars_indexed_by_new_lifted_defns : Variable.t Projection.Map.t;
|
||||
functions : for_one_function Variable.Map.t;
|
||||
make_direct_call_surrogates_for : Variable.Set.t;
|
||||
}
|
||||
|
||||
let lift_projection t ~(projection : Projection.t) =
|
||||
|
@ -237,8 +253,12 @@ module Processed_what_to_specialise = struct
|
|||
Variable.Set.mem inner_var params)
|
||||
t.set_of_closures.specialised_args
|
||||
in
|
||||
let make_direct_call_surrogates =
|
||||
Variable.Set.mem fun_var t.make_direct_call_surrogates_for
|
||||
in
|
||||
{ fun_var;
|
||||
function_decl;
|
||||
make_direct_call_surrogates;
|
||||
new_definitions_indexed_by_new_inner_vars = Variable.Map.empty;
|
||||
all_new_definitions = Definition.Set.empty;
|
||||
new_inner_to_new_outer_vars = Variable.Map.empty;
|
||||
|
@ -296,6 +316,8 @@ module Processed_what_to_specialise = struct
|
|||
new_lifted_defns_indexed_by_new_outer_vars = Variable.Map.empty;
|
||||
new_outer_vars_indexed_by_new_lifted_defns = Projection.Map.empty;
|
||||
functions = Variable.Map.empty;
|
||||
make_direct_call_surrogates_for =
|
||||
what_to_specialise.make_direct_call_surrogates_for;
|
||||
}
|
||||
in
|
||||
(* It is important to limit the number of arguments added: if arguments
|
||||
|
@ -521,7 +543,7 @@ module Make (T : S) = struct
|
|||
new_fun_var, new_function_decl, rewritten_existing_specialised_args,
|
||||
benefit
|
||||
|
||||
let rewrite_function_decl (t : P.t)
|
||||
let rewrite_function_decl (t : P.t) ~env ~duplicate_function
|
||||
~(for_one_function : P.for_one_function) ~benefit =
|
||||
let set_of_closures = t.set_of_closures in
|
||||
let fun_var = for_one_function.fun_var in
|
||||
|
@ -530,7 +552,10 @@ module Make (T : S) = struct
|
|||
Variable.Map.cardinal for_one_function.
|
||||
new_definitions_indexed_by_new_inner_vars
|
||||
in
|
||||
if function_decl.stub || num_definitions < 1 then
|
||||
if function_decl.stub
|
||||
|| num_definitions < 1
|
||||
|| Variable.Map.mem fun_var set_of_closures.direct_call_surrogates
|
||||
then
|
||||
None
|
||||
else
|
||||
let new_fun_var, wrapper, rewritten_existing_specialised_args, benefit =
|
||||
|
@ -567,6 +592,18 @@ module Make (T : S) = struct
|
|||
Variable.Map.disjoint_union rewritten_existing_specialised_args
|
||||
new_specialised_args
|
||||
in
|
||||
let specialised_args, existing_function_decl =
|
||||
if not for_one_function.make_direct_call_surrogates then
|
||||
specialised_args, None
|
||||
else
|
||||
let function_decl, new_specialised_args =
|
||||
duplicate_function ~env ~set_of_closures ~fun_var
|
||||
in
|
||||
let specialised_args =
|
||||
Variable.Map.disjoint_union specialised_args new_specialised_args
|
||||
in
|
||||
specialised_args, Some function_decl
|
||||
in
|
||||
let all_params =
|
||||
let new_params =
|
||||
Variable.Set.elements (Variable.Map.keys
|
||||
|
@ -584,11 +621,38 @@ module Make (T : S) = struct
|
|||
~specialise:function_decl.specialise
|
||||
~is_a_functor:function_decl.is_a_functor
|
||||
in
|
||||
let funs =
|
||||
Variable.Map.add new_fun_var rewritten_function_decl
|
||||
(Variable.Map.add fun_var wrapper Variable.Map.empty)
|
||||
let funs, direct_call_surrogates =
|
||||
if for_one_function.make_direct_call_surrogates then
|
||||
let surrogate = Variable.rename fun_var ~append:"_surrogate" in
|
||||
let funs =
|
||||
(* In this case, the original function declaration remains
|
||||
untouched up to alpha-equivalence. Direct calls to it
|
||||
(including inside the rewritten original function) will be
|
||||
replaced by calls to the surrogate (i.e. the wrapper) which
|
||||
will then be inlined. *)
|
||||
let existing_function_decl =
|
||||
match existing_function_decl with
|
||||
| Some decl -> decl
|
||||
| None -> assert false
|
||||
in
|
||||
Variable.Map.add new_fun_var rewritten_function_decl
|
||||
(Variable.Map.add surrogate wrapper
|
||||
(Variable.Map.add fun_var existing_function_decl
|
||||
Variable.Map.empty))
|
||||
in
|
||||
let direct_call_surrogates =
|
||||
Variable.Map.add fun_var surrogate Variable.Map.empty
|
||||
in
|
||||
funs, direct_call_surrogates
|
||||
else
|
||||
let funs =
|
||||
Variable.Map.add new_fun_var rewritten_function_decl
|
||||
(Variable.Map.add fun_var wrapper Variable.Map.empty)
|
||||
in
|
||||
funs, Variable.Map.empty
|
||||
in
|
||||
Some (funs, specialised_args, benefit)
|
||||
let free_vars = Variable.Map.empty in
|
||||
Some (funs, free_vars, specialised_args, direct_call_surrogates, benefit)
|
||||
|
||||
let add_lifted_projections_around_set_of_closures
|
||||
~(set_of_closures : Flambda.set_of_closures) ~benefit
|
||||
|
@ -606,38 +670,53 @@ module Make (T : S) = struct
|
|||
new_lifted_defns_indexed_by_new_outer_vars
|
||||
(body, benefit)
|
||||
|
||||
let rewrite_set_of_closures_core ~env ~benefit
|
||||
let rewrite_set_of_closures_core ~env ~duplicate_function ~benefit
|
||||
~(set_of_closures : Flambda.set_of_closures) =
|
||||
let what_to_specialise =
|
||||
P.create ~env ~variable_suffix:T.variable_suffix
|
||||
~what_to_specialise:(T.what_to_specialise ~env ~set_of_closures)
|
||||
in
|
||||
let original_set_of_closures = set_of_closures in
|
||||
let funs, specialised_args, done_something, benefit =
|
||||
let funs, free_vars, specialised_args, direct_call_surrogates,
|
||||
done_something, benefit =
|
||||
Variable.Map.fold (fun fun_var function_decl
|
||||
(funs, specialised_args, done_something, benefit) ->
|
||||
(funs, free_vars, specialised_args, direct_call_surrogates,
|
||||
done_something, benefit) ->
|
||||
match Variable.Map.find fun_var what_to_specialise.functions with
|
||||
| exception Not_found ->
|
||||
let funs = Variable.Map.add fun_var function_decl funs in
|
||||
funs, specialised_args, done_something, benefit
|
||||
funs, free_vars, specialised_args, direct_call_surrogates,
|
||||
done_something, benefit
|
||||
| (for_one_function : P.for_one_function) ->
|
||||
assert (Variable.equal fun_var for_one_function.fun_var);
|
||||
match
|
||||
rewrite_function_decl what_to_specialise
|
||||
~for_one_function ~benefit
|
||||
rewrite_function_decl what_to_specialise ~env
|
||||
~duplicate_function ~for_one_function ~benefit
|
||||
with
|
||||
| None ->
|
||||
let function_decl = for_one_function.function_decl in
|
||||
let funs = Variable.Map.add fun_var function_decl funs in
|
||||
funs, specialised_args, done_something, benefit
|
||||
| Some (funs', specialised_args', benefit) ->
|
||||
funs, free_vars, specialised_args, direct_call_surrogates,
|
||||
done_something, benefit
|
||||
| Some (funs', free_vars', specialised_args',
|
||||
direct_call_surrogates', benefit) ->
|
||||
let funs = Variable.Map.disjoint_union funs funs' in
|
||||
let direct_call_surrogates =
|
||||
Variable.Map.disjoint_union direct_call_surrogates
|
||||
direct_call_surrogates'
|
||||
in
|
||||
let free_vars =
|
||||
Variable.Map.disjoint_union free_vars free_vars'
|
||||
in
|
||||
let specialised_args =
|
||||
Variable.Map.disjoint_union specialised_args specialised_args'
|
||||
in
|
||||
funs, specialised_args, true, benefit)
|
||||
funs, free_vars, specialised_args, direct_call_surrogates, true,
|
||||
benefit)
|
||||
set_of_closures.function_decls.funs
|
||||
(Variable.Map.empty, set_of_closures.specialised_args, false, benefit)
|
||||
(Variable.Map.empty, set_of_closures.free_vars,
|
||||
set_of_closures.specialised_args,
|
||||
set_of_closures.direct_call_surrogates, false, benefit)
|
||||
in
|
||||
if not done_something then
|
||||
None
|
||||
|
@ -651,8 +730,9 @@ module Make (T : S) = struct
|
|||
let set_of_closures =
|
||||
Flambda.create_set_of_closures
|
||||
~function_decls
|
||||
~free_vars:set_of_closures.free_vars
|
||||
~free_vars
|
||||
~specialised_args
|
||||
~direct_call_surrogates
|
||||
in
|
||||
if !Clflags.flambda_invariant_checks then begin
|
||||
check_invariants ~set_of_closures ~original_set_of_closures
|
||||
|
@ -665,10 +745,11 @@ module Make (T : S) = struct
|
|||
in
|
||||
Some (expr, benefit)
|
||||
|
||||
let rewrite_set_of_closures ~env ~set_of_closures =
|
||||
let rewrite_set_of_closures ~env ~duplicate_function ~set_of_closures =
|
||||
Pass_wrapper.with_dump ~pass_name:T.pass_name ~input:set_of_closures
|
||||
~print_input:Flambda.print_set_of_closures
|
||||
~print_output:(fun ppf (expr, _) -> Flambda.print ppf expr)
|
||||
~f:(fun () -> rewrite_set_of_closures_core
|
||||
~env ~benefit:B.zero ~set_of_closures)
|
||||
~f:(fun () ->
|
||||
rewrite_set_of_closures_core ~env ~duplicate_function
|
||||
~benefit:B.zero ~set_of_closures)
|
||||
end
|
||||
|
|
|
@ -35,6 +35,8 @@ module What_to_specialise : sig
|
|||
-> group:Variable.t
|
||||
-> definition:Definition.t (* [projecting_from] "existing inner vars" *)
|
||||
-> t
|
||||
|
||||
val make_direct_call_surrogate_for : t -> fun_var:Variable.t -> t
|
||||
end
|
||||
|
||||
module type S = sig
|
||||
|
@ -48,8 +50,16 @@ module type S = sig
|
|||
end
|
||||
|
||||
module Make (T : S) : sig
|
||||
(** [duplicate_function] should be
|
||||
[Inline_and_simplify.duplicate_function]. *)
|
||||
val rewrite_set_of_closures
|
||||
: env:Inline_and_simplify_aux.Env.t
|
||||
-> duplicate_function:(
|
||||
env:Inline_and_simplify_aux.Env.t
|
||||
-> set_of_closures:Flambda.set_of_closures
|
||||
-> fun_var:Variable.t
|
||||
-> Flambda.function_declaration
|
||||
* Flambda.specialised_to Variable.Map.t)
|
||||
-> set_of_closures:Flambda.set_of_closures
|
||||
-> (Flambda.expr * Inlining_cost.Benefit.t) option
|
||||
end
|
||||
|
|
|
@ -587,6 +587,7 @@ and close_functions t external_env function_declarations : Flambda.named =
|
|||
in
|
||||
Flambda.create_set_of_closures ~function_decls ~free_vars
|
||||
~specialised_args:Variable.Map.empty
|
||||
~direct_call_surrogates:Variable.Map.empty
|
||||
in
|
||||
Set_of_closures set_of_closures
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ and set_of_closures = {
|
|||
function_decls : function_declarations;
|
||||
free_vars : specialised_to Variable.Map.t;
|
||||
specialised_args : specialised_to Variable.Map.t;
|
||||
direct_call_surrogates : Variable.t Variable.Map.t;
|
||||
}
|
||||
|
||||
and function_declarations = {
|
||||
|
@ -390,11 +391,14 @@ and print_set_of_closures ppf (set_of_closures : set_of_closures) =
|
|||
end
|
||||
in
|
||||
fprintf ppf "@[<2>(set_of_closures id=%a@ %a@ @[<2>free_vars={%a@ }@]@ \
|
||||
@[<2>specialised_args={%a})@]@]"
|
||||
@[<2>specialised_args={%a})@]@ \
|
||||
@[<2>direct_call_surrogates=%a@]@]"
|
||||
Set_of_closures_id.print function_decls.set_of_closures_id
|
||||
funs function_decls.funs
|
||||
vars free_vars
|
||||
spec specialised_args
|
||||
(Variable.Map.print Variable.print)
|
||||
set_of_closures.direct_call_surrogates
|
||||
|
||||
and print_const ppf (c : const) =
|
||||
match c with
|
||||
|
@ -1017,7 +1021,8 @@ let update_function_declarations function_decls ~funs =
|
|||
funs;
|
||||
}
|
||||
|
||||
let create_set_of_closures ~function_decls ~free_vars ~specialised_args =
|
||||
let create_set_of_closures ~function_decls ~free_vars ~specialised_args
|
||||
~direct_call_surrogates =
|
||||
if !Clflags.flambda_invariant_checks then begin
|
||||
let all_fun_vars = Variable.Map.keys function_decls.funs in
|
||||
let expected_free_vars =
|
||||
|
@ -1076,6 +1081,7 @@ let create_set_of_closures ~function_decls ~free_vars ~specialised_args =
|
|||
{ function_decls;
|
||||
free_vars;
|
||||
specialised_args;
|
||||
direct_call_surrogates;
|
||||
}
|
||||
|
||||
let used_params function_decl =
|
||||
|
|
|
@ -259,6 +259,13 @@ and set_of_closures = private {
|
|||
is essential to transport the closure freshening information to the
|
||||
point of use (e.g. a [Project_var] from such an argument).
|
||||
*)
|
||||
direct_call_surrogates : Variable.t Variable.Map.t;
|
||||
(** If [direct_call_surrogates] maps [fun_var1] to [fun_var2] then direct
|
||||
calls to [fun_var1] should be redirected to [fun_var2]. This is used
|
||||
to reduce the overhead of transformations that introduce wrapper
|
||||
functions (which will be inlined at direct call sites, but will
|
||||
penalise indirect call sites).
|
||||
[direct_call_surrogates] may not be transitively closed. *)
|
||||
}
|
||||
|
||||
and function_declarations = private {
|
||||
|
@ -550,6 +557,7 @@ val create_set_of_closures
|
|||
: function_decls:function_declarations
|
||||
-> free_vars:specialised_to Variable.Map.t
|
||||
-> specialised_args:specialised_to Variable.Map.t
|
||||
-> direct_call_surrogates:Variable.t Variable.Map.t
|
||||
-> set_of_closures
|
||||
|
||||
(** Given a function declaration, find which of its parameters (if any)
|
||||
|
|
|
@ -258,8 +258,9 @@ let variable_and_symbol_invariants (program : Flambda.program) =
|
|||
| Expr expr ->
|
||||
loop env expr
|
||||
and loop_set_of_closures env
|
||||
({ Flambda.function_decls; free_vars; specialised_args; }
|
||||
as set_of_closures) =
|
||||
({ Flambda.function_decls; free_vars; specialised_args;
|
||||
direct_call_surrogates = _; } as set_of_closures) =
|
||||
(* CR-soon mshinwell: check [direct_call_surrogates] *)
|
||||
let { Flambda.set_of_closures_id; set_of_closures_origin; funs; } =
|
||||
function_decls
|
||||
in
|
||||
|
|
|
@ -397,7 +397,8 @@ let map_general ~toplevel f f_named tree =
|
|||
| Symbol _ | Const _ | Allocated_const _ | Read_mutable _
|
||||
| Project_closure _ | Move_within_set_of_closures _ | Project_var _
|
||||
| Prim _ | Read_symbol_field _ -> named
|
||||
| Set_of_closures ({ function_decls; free_vars; specialised_args }) ->
|
||||
| Set_of_closures ({ function_decls; free_vars; specialised_args;
|
||||
direct_call_surrogates }) ->
|
||||
if toplevel then named
|
||||
else begin
|
||||
let done_something = ref false in
|
||||
|
@ -427,7 +428,7 @@ let map_general ~toplevel f f_named tree =
|
|||
in
|
||||
let set_of_closures =
|
||||
Flambda.create_set_of_closures ~function_decls ~free_vars
|
||||
~specialised_args
|
||||
~specialised_args ~direct_call_surrogates
|
||||
in
|
||||
Set_of_closures set_of_closures
|
||||
end
|
||||
|
@ -487,7 +488,8 @@ let map_symbols tree ~f =
|
|||
tree
|
||||
|
||||
let map_symbols_on_set_of_closures
|
||||
({ Flambda.function_decls; free_vars; specialised_args } as
|
||||
({ Flambda.function_decls; free_vars; specialised_args;
|
||||
direct_call_surrogates; } as
|
||||
set_of_closures)
|
||||
~f =
|
||||
let done_something = ref false in
|
||||
|
@ -514,7 +516,7 @@ let map_symbols_on_set_of_closures
|
|||
Flambda.update_function_declarations function_decls ~funs
|
||||
in
|
||||
Flambda.create_set_of_closures ~function_decls ~free_vars
|
||||
~specialised_args
|
||||
~specialised_args ~direct_call_surrogates
|
||||
|
||||
let map_toplevel_sets_of_closures tree ~f =
|
||||
map_toplevel_named (function
|
||||
|
@ -611,6 +613,7 @@ let map_function_bodies (set_of_closures : Flambda.set_of_closures) ~f =
|
|||
~function_decls
|
||||
~free_vars:set_of_closures.free_vars
|
||||
~specialised_args:set_of_closures.specialised_args
|
||||
~direct_call_surrogates:set_of_closures.direct_call_surrogates
|
||||
|
||||
let map_sets_of_closures_of_program (program : Flambda.program)
|
||||
~(f : Flambda.set_of_closures -> Flambda.set_of_closures) =
|
||||
|
@ -649,6 +652,7 @@ let map_sets_of_closures_of_program (program : Flambda.program)
|
|||
Flambda.create_set_of_closures ~function_decls
|
||||
~free_vars:set_of_closures.free_vars
|
||||
~specialised_args:set_of_closures.specialised_args
|
||||
~direct_call_surrogates:set_of_closures.direct_call_surrogates
|
||||
in
|
||||
match program with
|
||||
| Let_symbol (symbol, Set_of_closures set_of_closures, program') ->
|
||||
|
@ -746,6 +750,7 @@ let map_exprs_at_toplevel_of_program (program : Flambda.program)
|
|||
Flambda.create_set_of_closures ~function_decls
|
||||
~free_vars:set_of_closures.free_vars
|
||||
~specialised_args:set_of_closures.specialised_args
|
||||
~direct_call_surrogates:set_of_closures.direct_call_surrogates
|
||||
in
|
||||
(* CR-soon mshinwell: code very similar to the above function *)
|
||||
match program with
|
||||
|
|
|
@ -283,6 +283,7 @@ let toplevel_substitution sb tree =
|
|||
(Variable.Map.map (fun (spec_to : Flambda.specialised_to) ->
|
||||
{ spec_to with var = sb spec_to.var; })
|
||||
set_of_closures.specialised_args)
|
||||
~direct_call_surrogates:set_of_closures.direct_call_surrogates
|
||||
in
|
||||
Set_of_closures set_of_closures
|
||||
| Project_closure project_closure ->
|
||||
|
@ -314,7 +315,7 @@ let toplevel_substitution_named sb named =
|
|||
| Let let_expr -> let_expr.defining_expr
|
||||
| _ -> assert false
|
||||
|
||||
let make_closure_declaration ~id ~body ~params : Flambda.t =
|
||||
let make_closure_declaration ~id ~body ~params ~stub : Flambda.t =
|
||||
let free_variables = Flambda.free_variables body in
|
||||
let param_set = Variable.Set.of_list params in
|
||||
if not (Variable.Set.subset param_set free_variables) then begin
|
||||
|
@ -332,7 +333,7 @@ let make_closure_declaration ~id ~body ~params : Flambda.t =
|
|||
let subst id = Variable.Map.find id sb in
|
||||
let function_declaration =
|
||||
Flambda.create_function_declaration ~params:(List.map subst params)
|
||||
~body ~stub:false ~dbg:Debuginfo.none ~inline:Default_inline
|
||||
~body ~stub ~dbg:Debuginfo.none ~inline:Default_inline
|
||||
~specialise:Default_specialise ~is_a_functor:false
|
||||
in
|
||||
assert (Variable.Set.equal (Variable.Set.map subst free_variables)
|
||||
|
@ -362,6 +363,7 @@ let make_closure_declaration ~id ~body ~params : Flambda.t =
|
|||
in
|
||||
Flambda.create_set_of_closures ~function_decls ~free_vars
|
||||
~specialised_args:Variable.Map.empty
|
||||
~direct_call_surrogates:Variable.Map.empty
|
||||
in
|
||||
let project_closure : Flambda.named =
|
||||
Project_closure {
|
||||
|
@ -575,6 +577,7 @@ let substitute_read_symbol_field_for_variables
|
|||
(Variable.Map.map (fun (spec_to : Flambda.specialised_to) ->
|
||||
{ spec_to with var = sb spec_to.var; })
|
||||
set_of_closures.specialised_args)
|
||||
~direct_call_surrogates:set_of_closures.direct_call_surrogates
|
||||
in
|
||||
Set_of_closures set_of_closures
|
||||
| Project_closure project_closure ->
|
||||
|
|
|
@ -70,6 +70,7 @@ val make_closure_declaration
|
|||
: id:Variable.t
|
||||
-> body:Flambda.t
|
||||
-> params:Variable.t list
|
||||
-> stub:bool
|
||||
-> Flambda.t
|
||||
|
||||
val toplevel_substitution
|
||||
|
|
|
@ -273,10 +273,15 @@ module Project_var = struct
|
|||
* The new environment with added substitution
|
||||
* a fresh ffunction_subst with only the substitution of free variables
|
||||
*)
|
||||
let subst_free_vars fv subst
|
||||
let subst_free_vars fv subst ~only_freshen_parameters
|
||||
: (Flambda.specialised_to * _) Variable.Map.t * _ * _ =
|
||||
Variable.Map.fold (fun id lam (fv, subst, t) ->
|
||||
let id, subst, t = new_subst_fv t id subst in
|
||||
let id, subst, t =
|
||||
if only_freshen_parameters then
|
||||
id, subst, t
|
||||
else
|
||||
new_subst_fv t id subst
|
||||
in
|
||||
Variable.Map.add id lam fv, subst, t)
|
||||
fv
|
||||
(Variable.Map.empty, subst, empty)
|
||||
|
@ -289,7 +294,8 @@ module Project_var = struct
|
|||
subst_free_vars must have been used to build off_sb
|
||||
*)
|
||||
let func_decls_subst t (subst : subst)
|
||||
(func_decls : Flambda.function_declarations) =
|
||||
(func_decls : Flambda.function_declarations)
|
||||
~only_freshen_parameters =
|
||||
match subst with
|
||||
| Inactive -> func_decls, subst, t
|
||||
| Active subst ->
|
||||
|
@ -310,16 +316,22 @@ module Project_var = struct
|
|||
function_decl, subst
|
||||
in
|
||||
let subst, t =
|
||||
Variable.Map.fold (fun orig_id _func_decl (subst, t) ->
|
||||
let _id, subst, t = new_subst_fun t orig_id subst in
|
||||
subst, t)
|
||||
func_decls.funs
|
||||
(subst, t)
|
||||
if only_freshen_parameters then
|
||||
subst, t
|
||||
else
|
||||
Variable.Map.fold (fun orig_id _func_decl (subst, t) ->
|
||||
let _id, subst, t = new_subst_fun t orig_id subst in
|
||||
subst, t)
|
||||
func_decls.funs
|
||||
(subst, t)
|
||||
in
|
||||
let funs, subst =
|
||||
Variable.Map.fold (fun orig_id func_decl (funs, subst) ->
|
||||
let func_decl, subst = subst_func_decl orig_id func_decl subst in
|
||||
let id = active_find_var_exn subst orig_id in
|
||||
let id =
|
||||
if only_freshen_parameters then orig_id
|
||||
else active_find_var_exn subst orig_id
|
||||
in
|
||||
let funs = Variable.Map.add id func_decl funs in
|
||||
funs, subst)
|
||||
func_decls.funs
|
||||
|
@ -371,11 +383,12 @@ module Project_var = struct
|
|||
}
|
||||
end
|
||||
|
||||
let apply_function_decls_and_free_vars t fv func_decls =
|
||||
let apply_function_decls_and_free_vars t fv func_decls
|
||||
~only_freshen_parameters =
|
||||
let module I = Project_var in
|
||||
let fv, t, of_closures = I.subst_free_vars fv t in
|
||||
let fv, t, of_closures = I.subst_free_vars fv t ~only_freshen_parameters in
|
||||
let func_decls, t, of_closures =
|
||||
I.func_decls_subst of_closures t func_decls
|
||||
I.func_decls_subst of_closures t func_decls ~only_freshen_parameters
|
||||
in
|
||||
fv, func_decls, t, of_closures
|
||||
|
||||
|
|
|
@ -139,6 +139,7 @@ val apply_function_decls_and_free_vars
|
|||
: t
|
||||
-> (Flambda.specialised_to * 'a) Variable.Map.t
|
||||
-> Flambda.function_declarations
|
||||
-> only_freshen_parameters:bool
|
||||
-> (Flambda.specialised_to * 'a) Variable.Map.t
|
||||
* Flambda.function_declarations
|
||||
* t
|
||||
|
|
|
@ -171,29 +171,6 @@ let simplify_named_using_approx_and_env env r original_named approx =
|
|||
in
|
||||
named, r
|
||||
|
||||
(* This adds only the minimal set of approximations to the closures.
|
||||
It is not strictly necessary to have this restriction, but it helps
|
||||
to catch potential substitution bugs. *)
|
||||
let populate_closure_approximations
|
||||
~(function_decl : Flambda.function_declaration)
|
||||
~(free_vars : (_ * A.t) Variable.Map.t)
|
||||
~(parameter_approximations : A.t Variable.Map.t)
|
||||
~set_of_closures_env =
|
||||
(* Add approximations of free variables *)
|
||||
let env =
|
||||
Variable.Map.fold (fun id (_, desc) env ->
|
||||
E.add_outer_scope env id desc)
|
||||
free_vars set_of_closures_env in
|
||||
|
||||
(* Add known approximations of function parameters *)
|
||||
let env =
|
||||
List.fold_left (fun env id ->
|
||||
let approx = try Variable.Map.find id parameter_approximations
|
||||
with Not_found -> (A.value_unknown Other) in
|
||||
E.add env id approx)
|
||||
env function_decl.params in
|
||||
env
|
||||
|
||||
let simplify_const (const : Flambda.const) =
|
||||
match const with
|
||||
| Int i -> A.value_int i
|
||||
|
@ -601,132 +578,22 @@ and simplify_set_of_closures original_env r
|
|||
~make_closure_symbol:Backend.closure_symbol
|
||||
in
|
||||
let env = E.increase_closure_depth original_env in
|
||||
let free_vars =
|
||||
Variable.Map.map (fun (external_var : Flambda.specialised_to) ->
|
||||
let var =
|
||||
let var =
|
||||
Freshening.apply_variable (E.freshening env) external_var.var
|
||||
in
|
||||
match
|
||||
A.simplify_var_to_var_using_env (E.find_exn env var)
|
||||
~is_present_in_env:(fun var -> E.mem env var)
|
||||
with
|
||||
| None -> var
|
||||
| Some var -> var
|
||||
in
|
||||
let approx = E.find_exn env var in
|
||||
(* The projections are freshened below in one step, once we know
|
||||
the closure freshening substitution. *)
|
||||
let projection = external_var.projection in
|
||||
({ var; projection; } : Flambda.specialised_to), approx)
|
||||
set_of_closures.free_vars
|
||||
let free_vars, specialised_args, function_decls, parameter_approximations,
|
||||
internal_value_set_of_closures, set_of_closures_env =
|
||||
Inline_and_simplify_aux.prepare_to_simplify_set_of_closures ~env
|
||||
~set_of_closures ~function_decls ~only_for_function_decl:None
|
||||
~freshen:true
|
||||
in
|
||||
let specialised_args =
|
||||
Variable.Map.map (fun (spec_to : Flambda.specialised_to) ->
|
||||
let external_var = spec_to.var in
|
||||
let var = Freshening.apply_variable (E.freshening env) external_var in
|
||||
let var =
|
||||
match
|
||||
A.simplify_var_to_var_using_env (E.find_exn env var)
|
||||
~is_present_in_env:(fun var -> E.mem env var)
|
||||
with
|
||||
| None -> var
|
||||
| Some var -> var
|
||||
in
|
||||
let projection = spec_to.projection in
|
||||
({ var; projection; } : Flambda.specialised_to))
|
||||
set_of_closures.specialised_args
|
||||
in
|
||||
let environment_before_cleaning = env in
|
||||
(* [E.local] helps us to catch bugs whereby variables escape their scope. *)
|
||||
let env = E.local env in
|
||||
let free_vars, function_decls, sb, freshening =
|
||||
Freshening.apply_function_decls_and_free_vars (E.freshening env) free_vars
|
||||
function_decls
|
||||
in
|
||||
let env = E.set_freshening env sb in
|
||||
let free_vars =
|
||||
Freshening.freshen_projection_relation' free_vars
|
||||
~freshening:(E.freshening env)
|
||||
~closure_freshening:freshening
|
||||
in
|
||||
let specialised_args =
|
||||
let specialised_args =
|
||||
Variable.Map.map_keys (Freshening.apply_variable (E.freshening env))
|
||||
specialised_args
|
||||
in
|
||||
Freshening.freshen_projection_relation specialised_args
|
||||
~freshening:(E.freshening env)
|
||||
~closure_freshening:freshening
|
||||
in
|
||||
let parameter_approximations =
|
||||
(* Approximations of parameters that are known to always hold the same
|
||||
argument throughout the body of the function. *)
|
||||
Variable.Map.map_keys (Freshening.apply_variable (E.freshening env))
|
||||
(Variable.Map.mapi (fun _id' (spec_to : Flambda.specialised_to) ->
|
||||
E.find_exn environment_before_cleaning spec_to.var)
|
||||
specialised_args)
|
||||
in
|
||||
let env =
|
||||
E.enter_set_of_closures_declaration
|
||||
function_decls.set_of_closures_origin env
|
||||
in
|
||||
(* we use the previous closure for evaluating the functions *)
|
||||
let internal_value_set_of_closures =
|
||||
let bound_vars =
|
||||
Variable.Map.fold (fun id (_, desc) map ->
|
||||
Var_within_closure.Map.add (Var_within_closure.wrap id) desc map)
|
||||
free_vars Var_within_closure.Map.empty
|
||||
in
|
||||
A.create_value_set_of_closures ~function_decls ~bound_vars
|
||||
~invariant_params:(lazy Variable.Map.empty) ~specialised_args
|
||||
~freshening
|
||||
in
|
||||
(* Populate the environment with the approximation of each closure.
|
||||
This part of the environment is shared between all of the closures in
|
||||
the set of closures. *)
|
||||
let set_of_closures_env =
|
||||
Variable.Map.fold (fun closure _ env ->
|
||||
let approx =
|
||||
A.value_closure ~closure_var:closure internal_value_set_of_closures
|
||||
(Closure_id.wrap closure)
|
||||
in
|
||||
E.add env closure approx
|
||||
)
|
||||
function_decls.funs env
|
||||
in
|
||||
let simplify_function fid (function_decl : Flambda.function_declaration)
|
||||
let simplify_function fun_var (function_decl : Flambda.function_declaration)
|
||||
(funs, used_params, r)
|
||||
: Flambda.function_declaration Variable.Map.t * Variable.Set.t * R.t =
|
||||
let closure_env =
|
||||
populate_closure_approximations ~function_decl ~free_vars
|
||||
~parameter_approximations ~set_of_closures_env
|
||||
in
|
||||
(* Add definitions of known projections to the environment. *)
|
||||
let add_projections ~closure_env ~which_variables ~map =
|
||||
Variable.Map.fold (fun inner_var spec_arg env ->
|
||||
let (spec_arg : Flambda.specialised_to) = map spec_arg in
|
||||
match spec_arg.projection with
|
||||
| None -> env
|
||||
| Some projection ->
|
||||
let from = Projection.projecting_from projection in
|
||||
if Variable.Set.mem from function_decl.free_variables then
|
||||
E.add_projection env ~projection ~bound_to:inner_var
|
||||
else
|
||||
env)
|
||||
which_variables
|
||||
closure_env
|
||||
in
|
||||
let closure_env =
|
||||
add_projections ~closure_env ~which_variables:specialised_args
|
||||
~map:(fun spec_to -> spec_to)
|
||||
in
|
||||
let closure_env =
|
||||
add_projections ~closure_env ~which_variables:free_vars
|
||||
~map:(fun (spec_to, _approx) -> spec_to)
|
||||
Inline_and_simplify_aux.prepare_to_simplify_closure ~function_decl
|
||||
~free_vars ~specialised_args ~parameter_approximations
|
||||
~set_of_closures_env
|
||||
in
|
||||
let body, r =
|
||||
E.enter_closure closure_env ~closure_id:(Closure_id.wrap fid)
|
||||
E.enter_closure closure_env ~closure_id:(Closure_id.wrap fun_var)
|
||||
~inline_inside:
|
||||
(Inlining_decision.should_inline_inside_declaration function_decl)
|
||||
~debuginfo:function_decl.dbg
|
||||
|
@ -760,7 +627,7 @@ and simplify_set_of_closures original_env r
|
|||
~is_a_functor:function_decl.is_a_functor
|
||||
in
|
||||
let used_params' = Flambda.used_params function_decl in
|
||||
Variable.Map.add fid function_decl funs,
|
||||
Variable.Map.add fun_var function_decl funs,
|
||||
Variable.Set.union used_params used_params', r
|
||||
in
|
||||
let funs, _used_params, r =
|
||||
|
@ -780,11 +647,21 @@ and simplify_set_of_closures original_env r
|
|||
~invariant_params
|
||||
~specialised_args:internal_value_set_of_closures.specialised_args
|
||||
~freshening:internal_value_set_of_closures.freshening
|
||||
~direct_call_surrogates:
|
||||
internal_value_set_of_closures.direct_call_surrogates
|
||||
in
|
||||
let direct_call_surrogates =
|
||||
Closure_id.Map.fold (fun existing surrogate surrogates ->
|
||||
Variable.Map.add (Closure_id.unwrap existing)
|
||||
(Closure_id.unwrap surrogate) surrogates)
|
||||
internal_value_set_of_closures.direct_call_surrogates
|
||||
Variable.Map.empty
|
||||
in
|
||||
let set_of_closures =
|
||||
Flambda.create_set_of_closures ~function_decls
|
||||
~free_vars:(Variable.Map.map fst free_vars)
|
||||
~specialised_args
|
||||
~direct_call_surrogates
|
||||
in
|
||||
let r = ret r (A.value_set_of_closures value_set_of_closures) in
|
||||
set_of_closures, r, value_set_of_closures.freshening
|
||||
|
@ -803,9 +680,48 @@ and simplify_apply env r ~(apply : Flambda.apply) : Flambda.t * R.t =
|
|||
successful---in which case we then have a direct
|
||||
application---consider inlining. *)
|
||||
match A.check_approx_for_closure lhs_of_application_approx with
|
||||
| Ok (value_closure, _set_of_closures_var,
|
||||
_set_of_closures_symbol, value_set_of_closures) ->
|
||||
let closure_id_being_applied = value_closure.closure_id in
|
||||
| Ok (value_closure, set_of_closures_var,
|
||||
set_of_closures_symbol, value_set_of_closures) ->
|
||||
let lhs_of_application, closure_id_being_applied,
|
||||
value_set_of_closures, env, wrap =
|
||||
let closure_id_being_applied = value_closure.closure_id in
|
||||
(* If the call site is a direct call to a function that has a
|
||||
"direct call surrogate" (see inline_and_simplify_aux.mli),
|
||||
repoint the call to the surrogate. *)
|
||||
let surrogates = value_set_of_closures.direct_call_surrogates in
|
||||
match Closure_id.Map.find closure_id_being_applied surrogates with
|
||||
| exception Not_found ->
|
||||
lhs_of_application, closure_id_being_applied,
|
||||
value_set_of_closures, env, (fun expr -> expr)
|
||||
| surrogate ->
|
||||
let rec find_transitively surrogate =
|
||||
match Closure_id.Map.find surrogate surrogates with
|
||||
| exception Not_found -> surrogate
|
||||
| surrogate -> find_transitively surrogate
|
||||
in
|
||||
let surrogate = find_transitively surrogate in
|
||||
let surrogate_var =
|
||||
Variable.rename lhs_of_application ~append:"_surrogate"
|
||||
in
|
||||
let move_to_surrogate : Projection.move_within_set_of_closures =
|
||||
{ closure = lhs_of_application;
|
||||
start_from = closure_id_being_applied;
|
||||
move_to = surrogate;
|
||||
}
|
||||
in
|
||||
let approx_for_surrogate =
|
||||
A.value_closure ~closure_var:surrogate_var
|
||||
?set_of_closures_var ?set_of_closures_symbol
|
||||
value_set_of_closures surrogate
|
||||
in
|
||||
let env = E.add env surrogate_var approx_for_surrogate in
|
||||
let wrap expr =
|
||||
Flambda.create_let surrogate_var
|
||||
(Move_within_set_of_closures move_to_surrogate)
|
||||
expr
|
||||
in
|
||||
surrogate_var, surrogate, value_set_of_closures, env, wrap
|
||||
in
|
||||
let function_decls = value_set_of_closures.function_decls in
|
||||
let function_decl =
|
||||
try
|
||||
|
@ -825,23 +741,27 @@ and simplify_apply env r ~(apply : Flambda.apply) : Flambda.t * R.t =
|
|||
in
|
||||
let nargs = List.length args in
|
||||
let arity = Flambda_utils.function_arity function_decl in
|
||||
if nargs = arity then
|
||||
simplify_full_application env r ~function_decls ~lhs_of_application
|
||||
~closure_id_being_applied ~function_decl ~value_set_of_closures
|
||||
~args ~args_approxs ~dbg ~inline_requested ~specialise_requested
|
||||
else if nargs > arity then
|
||||
simplify_over_application env r ~args ~args_approxs ~function_decls
|
||||
~lhs_of_application ~closure_id_being_applied ~function_decl
|
||||
~value_set_of_closures ~dbg ~inline_requested
|
||||
~specialise_requested
|
||||
else if nargs > 0 && nargs < arity then
|
||||
simplify_partial_application env r ~lhs_of_application
|
||||
~closure_id_being_applied ~function_decl ~args ~dbg
|
||||
~inline_requested ~specialise_requested
|
||||
else
|
||||
Misc.fatal_errorf "Function with arity %d when simplifying \
|
||||
application expression: %a"
|
||||
arity Flambda.print (Flambda.Apply apply)
|
||||
let result, r =
|
||||
if nargs = arity then
|
||||
simplify_full_application env r ~function_decls
|
||||
~lhs_of_application ~closure_id_being_applied ~function_decl
|
||||
~value_set_of_closures ~args ~args_approxs ~dbg
|
||||
~inline_requested ~specialise_requested
|
||||
else if nargs > arity then
|
||||
simplify_over_application env r ~args ~args_approxs
|
||||
~function_decls ~lhs_of_application ~closure_id_being_applied
|
||||
~function_decl ~value_set_of_closures ~dbg ~inline_requested
|
||||
~specialise_requested
|
||||
else if nargs > 0 && nargs < arity then
|
||||
simplify_partial_application env r ~lhs_of_application
|
||||
~closure_id_being_applied ~function_decl ~args ~dbg
|
||||
~inline_requested ~specialise_requested
|
||||
else
|
||||
Misc.fatal_errorf "Function with arity %d when simplifying \
|
||||
application expression: %a"
|
||||
arity Flambda.print (Flambda.Apply apply)
|
||||
in
|
||||
wrap result, r
|
||||
| Wrong -> (* Insufficient approximation information to simplify. *)
|
||||
Apply ({ func = lhs_of_application; args; kind = Indirect; dbg;
|
||||
inline = inline_requested; specialise = specialise_requested; }),
|
||||
|
@ -910,6 +830,7 @@ and simplify_partial_application env r ~lhs_of_application
|
|||
Flambda_utils.make_closure_declaration ~id:closure_variable
|
||||
~body
|
||||
~params:remaining_args
|
||||
~stub:true
|
||||
in
|
||||
let with_known_args =
|
||||
Flambda_utils.bind
|
||||
|
@ -1025,39 +946,40 @@ and simplify_named env r (tree : Flambda.named) : Flambda.named * R.t =
|
|||
free variables and which things are specialised arguments before
|
||||
unboxing them. *)
|
||||
match
|
||||
Unbox_closures.rewrite_set_of_closures ~env ~set_of_closures
|
||||
Unbox_closures.rewrite_set_of_closures ~env
|
||||
~duplicate_function ~set_of_closures
|
||||
with
|
||||
| Some (expr, benefit) ->
|
||||
let r = R.add_benefit r benefit in
|
||||
simplify env r expr ~pass_name:"Unbox_closures"
|
||||
| None ->
|
||||
match Unbox_free_vars_of_closures.run ~env ~set_of_closures with
|
||||
| Some (expr, benefit) ->
|
||||
let r = R.add_benefit r benefit in
|
||||
simplify env r expr ~pass_name:"Unbox_closures"
|
||||
simplify env r expr ~pass_name:"Unbox_free_vars_of_closures"
|
||||
| None ->
|
||||
match Unbox_free_vars_of_closures.run ~env ~set_of_closures with
|
||||
(* CR-soon mshinwell: should maybe add one allocation for the stub *)
|
||||
match
|
||||
Unbox_specialised_args.rewrite_set_of_closures ~env
|
||||
~duplicate_function ~set_of_closures
|
||||
with
|
||||
| Some (expr, benefit) ->
|
||||
let r = R.add_benefit r benefit in
|
||||
simplify env r expr ~pass_name:"Unbox_free_vars_of_closures"
|
||||
simplify env r expr ~pass_name:"Unbox_specialised_args"
|
||||
| None ->
|
||||
(* CR-soon mshinwell: should maybe add one allocation for the stub *)
|
||||
match
|
||||
Unbox_specialised_args.rewrite_set_of_closures ~env
|
||||
~set_of_closures
|
||||
Remove_unused_arguments.
|
||||
separate_unused_arguments_in_set_of_closures
|
||||
set_of_closures ~backend
|
||||
with
|
||||
| Some (expr, benefit) ->
|
||||
let r = R.add_benefit r benefit in
|
||||
simplify env r expr ~pass_name:"Unbox_specialised_args"
|
||||
| Some set_of_closures ->
|
||||
let expr =
|
||||
Flambda_utils.name_expr (Set_of_closures set_of_closures)
|
||||
~name:"remove_unused_arguments"
|
||||
in
|
||||
simplify env r expr ~pass_name:"Remove_unused_arguments"
|
||||
| None ->
|
||||
match
|
||||
Remove_unused_arguments.
|
||||
separate_unused_arguments_in_set_of_closures
|
||||
set_of_closures ~backend
|
||||
with
|
||||
| Some set_of_closures ->
|
||||
let expr =
|
||||
Flambda_utils.name_expr (Set_of_closures set_of_closures)
|
||||
~name:"remove_unused_arguments"
|
||||
in
|
||||
simplify env r expr ~pass_name:"Remove_unused_arguments"
|
||||
| None ->
|
||||
Set_of_closures set_of_closures, r
|
||||
Set_of_closures set_of_closures, r
|
||||
end
|
||||
| Project_closure project_closure ->
|
||||
simplify_project_closure env r ~project_closure
|
||||
|
@ -1394,6 +1316,50 @@ and simplify_list env r l =
|
|||
then l, approxs, r
|
||||
else h' :: t', approxs, r
|
||||
|
||||
and duplicate_function ~env ~(set_of_closures : Flambda.set_of_closures)
|
||||
~fun_var =
|
||||
let function_decl =
|
||||
match Variable.Map.find fun_var set_of_closures.function_decls.funs with
|
||||
| exception Not_found ->
|
||||
Misc.fatal_errorf "duplicate_function: cannot find function %a"
|
||||
Variable.print fun_var
|
||||
| function_decl -> function_decl
|
||||
in
|
||||
let env = E.activate_freshening (E.set_never_inline env) in
|
||||
let free_vars, specialised_args, function_decls, parameter_approximations,
|
||||
_internal_value_set_of_closures, set_of_closures_env =
|
||||
Inline_and_simplify_aux.prepare_to_simplify_set_of_closures ~env
|
||||
~set_of_closures ~function_decls:set_of_closures.function_decls
|
||||
~freshen:false ~only_for_function_decl:(Some function_decl)
|
||||
in
|
||||
let function_decl =
|
||||
match Variable.Map.find fun_var function_decls.funs with
|
||||
| exception Not_found ->
|
||||
Misc.fatal_errorf "duplicate_function: cannot find function %a (2)"
|
||||
Variable.print fun_var
|
||||
| function_decl -> function_decl
|
||||
in
|
||||
let closure_env =
|
||||
Inline_and_simplify_aux.prepare_to_simplify_closure ~function_decl
|
||||
~free_vars ~specialised_args ~parameter_approximations
|
||||
~set_of_closures_env
|
||||
in
|
||||
let body, _r =
|
||||
E.enter_closure closure_env
|
||||
~closure_id:(Closure_id.wrap fun_var)
|
||||
~inline_inside:false
|
||||
~debuginfo:function_decl.dbg
|
||||
~f:(fun body_env ->
|
||||
simplify body_env (R.create ()) function_decl.body)
|
||||
in
|
||||
let function_decl =
|
||||
Flambda.create_function_declaration ~params:function_decl.params
|
||||
~body ~stub:function_decl.stub ~dbg:function_decl.dbg
|
||||
~inline:function_decl.inline ~specialise:function_decl.specialise
|
||||
~is_a_functor:function_decl.is_a_functor
|
||||
in
|
||||
function_decl, specialised_args
|
||||
|
||||
let constant_defining_value_approx
|
||||
env
|
||||
(constant_defining_value:Flambda.constant_defining_value) =
|
||||
|
@ -1430,6 +1396,7 @@ let constant_defining_value_approx
|
|||
~invariant_params
|
||||
~specialised_args:Variable.Map.empty
|
||||
~freshening:Freshening.Project_var.empty
|
||||
~direct_call_surrogates:Closure_id.Map.empty
|
||||
in
|
||||
A.value_set_of_closures value_set_of_closures
|
||||
| Project_closure (set_of_closures_symbol, closure_id) -> begin
|
||||
|
|
|
@ -29,3 +29,10 @@ val run
|
|||
-> round:int
|
||||
-> Flambda.program
|
||||
-> Flambda.program
|
||||
|
||||
val duplicate_function
|
||||
: env:Inline_and_simplify_aux.Env.t
|
||||
-> set_of_closures:Flambda.set_of_closures
|
||||
-> fun_var:Variable.t
|
||||
-> Flambda.function_declaration
|
||||
* Flambda.specialised_to Variable.Map.t (* new specialised arguments *)
|
||||
|
|
|
@ -494,3 +494,187 @@ module Result = struct
|
|||
let num_direct_applications t =
|
||||
t.num_direct_applications
|
||||
end
|
||||
|
||||
module A = Simple_value_approx
|
||||
module E = Env
|
||||
|
||||
let prepare_to_simplify_set_of_closures ~env
|
||||
~(set_of_closures : Flambda.set_of_closures)
|
||||
~function_decls ~freshen
|
||||
~(only_for_function_decl : Flambda.function_declaration option) =
|
||||
let free_vars =
|
||||
Variable.Map.map (fun (external_var : Flambda.specialised_to) ->
|
||||
let var =
|
||||
let var =
|
||||
Freshening.apply_variable (E.freshening env) external_var.var
|
||||
in
|
||||
match
|
||||
A.simplify_var_to_var_using_env (E.find_exn env var)
|
||||
~is_present_in_env:(fun var -> E.mem env var)
|
||||
with
|
||||
| None -> var
|
||||
| Some var -> var
|
||||
in
|
||||
let approx = E.find_exn env var in
|
||||
(* The projections are freshened below in one step, once we know
|
||||
the closure freshening substitution. *)
|
||||
let projection = external_var.projection in
|
||||
({ var; projection; } : Flambda.specialised_to), approx)
|
||||
set_of_closures.free_vars
|
||||
in
|
||||
let specialised_args =
|
||||
Variable.Map.filter_map set_of_closures.specialised_args
|
||||
~f:(fun param (spec_to : Flambda.specialised_to) ->
|
||||
let keep =
|
||||
match only_for_function_decl with
|
||||
| None -> true
|
||||
| Some function_decl ->
|
||||
Variable.Set.mem param (Variable.Set.of_list function_decl.params)
|
||||
in
|
||||
if not keep then None
|
||||
else
|
||||
let external_var = spec_to.var in
|
||||
let var =
|
||||
Freshening.apply_variable (E.freshening env) external_var
|
||||
in
|
||||
let var =
|
||||
match
|
||||
A.simplify_var_to_var_using_env (E.find_exn env var)
|
||||
~is_present_in_env:(fun var -> E.mem env var)
|
||||
with
|
||||
| None -> var
|
||||
| Some var -> var
|
||||
in
|
||||
let projection = spec_to.projection in
|
||||
Some ({ var; projection; } : Flambda.specialised_to))
|
||||
in
|
||||
let environment_before_cleaning = env in
|
||||
(* [E.local] helps us to catch bugs whereby variables escape their scope. *)
|
||||
let env = E.local env in
|
||||
let free_vars, function_decls, sb, freshening =
|
||||
Freshening.apply_function_decls_and_free_vars (E.freshening env) free_vars
|
||||
function_decls ~only_freshen_parameters:(not freshen)
|
||||
in
|
||||
let env = E.set_freshening env sb in
|
||||
let free_vars =
|
||||
Freshening.freshen_projection_relation' free_vars
|
||||
~freshening:(E.freshening env)
|
||||
~closure_freshening:freshening
|
||||
in
|
||||
let specialised_args =
|
||||
let specialised_args =
|
||||
Variable.Map.map_keys (Freshening.apply_variable (E.freshening env))
|
||||
specialised_args
|
||||
in
|
||||
Freshening.freshen_projection_relation specialised_args
|
||||
~freshening:(E.freshening env)
|
||||
~closure_freshening:freshening
|
||||
in
|
||||
let parameter_approximations =
|
||||
(* Approximations of parameters that are known to always hold the same
|
||||
argument throughout the body of the function. *)
|
||||
Variable.Map.map_keys (Freshening.apply_variable (E.freshening env))
|
||||
(Variable.Map.mapi (fun _id' (spec_to : Flambda.specialised_to) ->
|
||||
E.find_exn environment_before_cleaning spec_to.var)
|
||||
specialised_args)
|
||||
in
|
||||
let direct_call_surrogates =
|
||||
Variable.Map.fold (fun existing surrogate surrogates ->
|
||||
let existing =
|
||||
Freshening.Project_var.apply_closure_id freshening
|
||||
(Closure_id.wrap existing)
|
||||
in
|
||||
let surrogate =
|
||||
Freshening.Project_var.apply_closure_id freshening
|
||||
(Closure_id.wrap surrogate)
|
||||
in
|
||||
assert (not (Closure_id.Map.mem existing surrogates));
|
||||
Closure_id.Map.add existing surrogate surrogates)
|
||||
set_of_closures.direct_call_surrogates
|
||||
Closure_id.Map.empty
|
||||
in
|
||||
let env =
|
||||
E.enter_set_of_closures_declaration
|
||||
function_decls.set_of_closures_origin env
|
||||
in
|
||||
(* we use the previous closure for evaluating the functions *)
|
||||
let internal_value_set_of_closures =
|
||||
let bound_vars =
|
||||
Variable.Map.fold (fun id (_, desc) map ->
|
||||
Var_within_closure.Map.add (Var_within_closure.wrap id) desc map)
|
||||
free_vars Var_within_closure.Map.empty
|
||||
in
|
||||
A.create_value_set_of_closures ~function_decls ~bound_vars
|
||||
~invariant_params:(lazy Variable.Map.empty) ~specialised_args
|
||||
~freshening ~direct_call_surrogates
|
||||
in
|
||||
(* Populate the environment with the approximation of each closure.
|
||||
This part of the environment is shared between all of the closures in
|
||||
the set of closures. *)
|
||||
let set_of_closures_env =
|
||||
Variable.Map.fold (fun closure _ env ->
|
||||
let approx =
|
||||
A.value_closure ~closure_var:closure internal_value_set_of_closures
|
||||
(Closure_id.wrap closure)
|
||||
in
|
||||
E.add env closure approx
|
||||
)
|
||||
function_decls.funs env
|
||||
in
|
||||
free_vars, specialised_args, function_decls, parameter_approximations,
|
||||
internal_value_set_of_closures, set_of_closures_env
|
||||
|
||||
(* This adds only the minimal set of approximations to the closures.
|
||||
It is not strictly necessary to have this restriction, but it helps
|
||||
to catch potential substitution bugs. *)
|
||||
let populate_closure_approximations
|
||||
~(function_decl : Flambda.function_declaration)
|
||||
~(free_vars : (_ * A.t) Variable.Map.t)
|
||||
~(parameter_approximations : A.t Variable.Map.t)
|
||||
~set_of_closures_env =
|
||||
(* Add approximations of free variables *)
|
||||
let env =
|
||||
Variable.Map.fold (fun id (_, desc) env ->
|
||||
E.add_outer_scope env id desc)
|
||||
free_vars set_of_closures_env
|
||||
in
|
||||
(* Add known approximations of function parameters *)
|
||||
let env =
|
||||
List.fold_left (fun env id ->
|
||||
let approx =
|
||||
try Variable.Map.find id parameter_approximations
|
||||
with Not_found -> (A.value_unknown Other)
|
||||
in
|
||||
E.add env id approx)
|
||||
env function_decl.params
|
||||
in
|
||||
env
|
||||
|
||||
let prepare_to_simplify_closure ~(function_decl : Flambda.function_declaration)
|
||||
~free_vars ~specialised_args ~parameter_approximations
|
||||
~set_of_closures_env =
|
||||
let closure_env =
|
||||
populate_closure_approximations ~function_decl ~free_vars
|
||||
~parameter_approximations ~set_of_closures_env
|
||||
in
|
||||
(* Add definitions of known projections to the environment. *)
|
||||
let add_projections ~closure_env ~which_variables ~map =
|
||||
Variable.Map.fold (fun inner_var spec_arg env ->
|
||||
let (spec_arg : Flambda.specialised_to) = map spec_arg in
|
||||
match spec_arg.projection with
|
||||
| None -> env
|
||||
| Some projection ->
|
||||
let from = Projection.projecting_from projection in
|
||||
if Variable.Set.mem from function_decl.free_variables then
|
||||
E.add_projection env ~projection ~bound_to:inner_var
|
||||
else
|
||||
env)
|
||||
which_variables
|
||||
closure_env
|
||||
in
|
||||
let closure_env =
|
||||
add_projections ~closure_env ~which_variables:specialised_args
|
||||
~map:(fun spec_to -> spec_to)
|
||||
in
|
||||
add_projections ~closure_env ~which_variables:free_vars
|
||||
~map:(fun (spec_to, _approx) -> spec_to)
|
||||
|
|
|
@ -313,7 +313,6 @@ module Result : sig
|
|||
|
||||
val seen_direct_application : t -> t
|
||||
val num_direct_applications : t -> int
|
||||
|
||||
end
|
||||
|
||||
(** Command line argument -inline *)
|
||||
|
@ -322,3 +321,24 @@ val initial_inlining_threshold : round:int -> Inlining_cost.Threshold.t
|
|||
(** Command line argument -inline-toplevel *)
|
||||
val initial_inlining_toplevel_threshold
|
||||
: round:int -> Inlining_cost.Threshold.t
|
||||
|
||||
val prepare_to_simplify_set_of_closures
|
||||
: env:Env.t
|
||||
-> set_of_closures:Flambda.set_of_closures
|
||||
-> function_decls:Flambda.function_declarations
|
||||
-> freshen:bool
|
||||
-> only_for_function_decl:Flambda.function_declaration option
|
||||
-> (Flambda.specialised_to * Simple_value_approx.t) Variable.Map.t (* fvs *)
|
||||
* Flambda.specialised_to Variable.Map.t (* specialised arguments *)
|
||||
* Flambda.function_declarations
|
||||
* Simple_value_approx.t Variable.Map.t (* parameter approximations *)
|
||||
* Simple_value_approx.value_set_of_closures
|
||||
* Env.t
|
||||
|
||||
val prepare_to_simplify_closure
|
||||
: function_decl:Flambda.function_declaration
|
||||
-> free_vars:(Flambda.specialised_to * Simple_value_approx.t) Variable.Map.t
|
||||
-> specialised_args:Flambda.specialised_to Variable.Map.t
|
||||
-> parameter_approximations:Simple_value_approx.t Variable.Map.t
|
||||
-> set_of_closures_env:Env.t
|
||||
-> Env.t
|
||||
|
|
|
@ -237,6 +237,7 @@ module Benefit = struct
|
|||
let remove_call t = { t with remove_call = t.remove_call + 1; }
|
||||
let remove_alloc t = { t with remove_alloc = t.remove_alloc + 1; }
|
||||
let remove_prim t = { t with remove_prim = t.remove_prim + 1; }
|
||||
let remove_prims t n = { t with remove_prim = t.remove_prim + n; }
|
||||
let remove_branch t = { t with remove_branch = t.remove_branch + 1; }
|
||||
let direct_call_of_indirect t =
|
||||
{ t with direct_call_of_indirect = t.direct_call_of_indirect + 1; }
|
||||
|
|
|
@ -70,8 +70,11 @@ module Benefit : sig
|
|||
val max : round:int -> t -> t -> t
|
||||
|
||||
val remove_call : t -> t
|
||||
(* CR-soon mshinwell: [remove_alloc] should take the size of the block
|
||||
(to account for removal of initializing writes). *)
|
||||
val remove_alloc : t -> t
|
||||
val remove_prim : t -> t
|
||||
val remove_prims : t -> int -> t
|
||||
val remove_branch : t -> t
|
||||
val direct_call_of_indirect : t -> t
|
||||
val requested_inline : t -> size_of:Flambda.t -> t
|
||||
|
@ -134,3 +137,5 @@ val maximum_interesting_size_of_function_body : int -> int
|
|||
below the given threshold. [None] is returned if it is too big; otherwise
|
||||
[Some] is returned with the measured size. *)
|
||||
val lambda_smaller' : Flambda.expr -> than:int -> int option
|
||||
|
||||
val lambda_size : Flambda.expr -> int
|
||||
|
|
|
@ -395,8 +395,9 @@ let specialise env r ~lhs_of_application
|
|||
~function_decls ~closure_id_being_applied ~function_decl
|
||||
~args ~args_approxs
|
||||
~invariant_params:value_set_of_closures.invariant_params
|
||||
~specialised_args:value_set_of_closures.specialised_args ~dbg
|
||||
~simplify ~inline_requested
|
||||
~specialised_args:value_set_of_closures.specialised_args
|
||||
~direct_call_surrogates:value_set_of_closures.direct_call_surrogates
|
||||
~dbg ~simplify ~inline_requested
|
||||
in
|
||||
match copied_function_declaration with
|
||||
| Some (expr, r_inlined) ->
|
||||
|
|
|
@ -186,7 +186,7 @@ let inline_by_copying_function_declaration ~env ~r
|
|||
~args ~args_approxs
|
||||
~(invariant_params:Variable.Set.t Variable.Map.t lazy_t)
|
||||
~(specialised_args : Flambda.specialised_to Variable.Map.t)
|
||||
~dbg ~simplify =
|
||||
~direct_call_surrogates ~dbg ~simplify =
|
||||
let original_function_decls = function_decls in
|
||||
let specialised_args_set = Variable.Map.keys specialised_args in
|
||||
let worth_specialising_args, specialisable_args, args, args_decl =
|
||||
|
@ -275,6 +275,19 @@ let inline_by_copying_function_declaration ~env ~r
|
|||
Variable.Set.mem func required_functions)
|
||||
function_decls.funs
|
||||
in
|
||||
let direct_call_surrogates =
|
||||
Closure_id.Map.fold (fun existing surrogate surrogates ->
|
||||
let existing = Closure_id.unwrap existing in
|
||||
let surrogate = Closure_id.unwrap surrogate in
|
||||
if Variable.Map.mem existing funs
|
||||
&& Variable.Map.mem surrogate funs
|
||||
then
|
||||
Variable.Map.add existing surrogate surrogates
|
||||
else
|
||||
surrogates)
|
||||
direct_call_surrogates
|
||||
Variable.Map.empty
|
||||
in
|
||||
let function_decls =
|
||||
Flambda.update_function_declarations ~funs function_decls
|
||||
in
|
||||
|
@ -331,6 +344,7 @@ let inline_by_copying_function_declaration ~env ~r
|
|||
information than the one being copied. *)
|
||||
Flambda.create_set_of_closures ~function_decls ~free_vars
|
||||
~specialised_args:specialisable_args
|
||||
~direct_call_surrogates
|
||||
in
|
||||
(* Generate a copy of the function application, including the function
|
||||
declaration(s), but with variables (not yet bound) in place of the
|
||||
|
|
|
@ -96,6 +96,7 @@ val inline_by_copying_function_declaration
|
|||
-> args_approxs:Simple_value_approx.t list
|
||||
-> invariant_params:Variable.Set.t Variable.Map.t lazy_t
|
||||
-> specialised_args:Flambda.specialised_to Variable.Map.t
|
||||
-> direct_call_surrogates:Closure_id.t Closure_id.Map.t
|
||||
-> dbg:Debuginfo.t
|
||||
-> simplify:Inlining_decision_intf.simplify
|
||||
-> (Flambda.t * Inline_and_simplify_aux.Result.t) option
|
||||
|
|
|
@ -633,7 +633,8 @@ let add_definitions_of_symbols constant_definitions initialize_symbol_tbl
|
|||
let introduce_free_variables_in_set_of_closures
|
||||
(var_to_block_field_tbl :
|
||||
Flambda.constant_defining_value_block_field Variable.Tbl.t)
|
||||
({ Flambda.function_decls; free_vars; specialised_args }
|
||||
({ Flambda.function_decls; free_vars; specialised_args;
|
||||
direct_call_surrogates; }
|
||||
as set_of_closures) =
|
||||
let add_definition_and_make_substitution var (expr, subst) =
|
||||
let searched_var =
|
||||
|
@ -659,8 +660,8 @@ let introduce_free_variables_in_set_of_closures
|
|||
let done_something = ref false in
|
||||
let function_decls : Flambda.function_declarations =
|
||||
Flambda.update_function_declarations function_decls
|
||||
~funs:(Variable.Map.mapi
|
||||
(fun _fun_var (func_decl : Flambda.function_declaration) ->
|
||||
~funs:(Variable.Map.map
|
||||
(fun (func_decl : Flambda.function_declaration) ->
|
||||
let variables_to_bind =
|
||||
(* Closures from the same set must not be bound. *)
|
||||
Variable.Set.diff func_decl.free_variables
|
||||
|
@ -717,7 +718,7 @@ let introduce_free_variables_in_set_of_closures
|
|||
set_of_closures
|
||||
else
|
||||
Flambda.create_set_of_closures ~function_decls ~free_vars
|
||||
~specialised_args
|
||||
~specialised_args ~direct_call_surrogates
|
||||
|
||||
let rewrite_project_var
|
||||
(var_to_block_field_tbl
|
||||
|
|
|
@ -94,7 +94,8 @@ let middle_end ppf ~source_provenance ~prefixname ~backend
|
|||
+-+ ("Ref_to_variables",
|
||||
Ref_to_variables.eliminate_ref)
|
||||
+-+ ("Remove_unused_closure_vars 2",
|
||||
Remove_unused_closure_vars.remove_unused_closure_variables)
|
||||
Remove_unused_closure_vars.remove_unused_closure_variables
|
||||
~remove_direct_call_surrogates:false)
|
||||
+-+ ("Initialize_symbol_to_let_symbol",
|
||||
Initialize_symbol_to_let_symbol.run)
|
||||
in
|
||||
|
@ -116,12 +117,14 @@ let middle_end ppf ~source_provenance ~prefixname ~backend
|
|||
Lift_let_to_initialize_symbol.lift ~backend)
|
||||
+-+ ("lift_lets 2", Lift_code.lift_lets)
|
||||
+-+ ("Remove_unused_closure_vars 1",
|
||||
Remove_unused_closure_vars.remove_unused_closure_variables)
|
||||
Remove_unused_closure_vars.remove_unused_closure_variables
|
||||
~remove_direct_call_surrogates:false)
|
||||
+-+ ("Inline_and_simplify",
|
||||
Inline_and_simplify.run ~never_inline:false ~backend
|
||||
~prefixname ~round)
|
||||
+-+ ("Remove_unused_closure_vars 2",
|
||||
Remove_unused_closure_vars.remove_unused_closure_variables)
|
||||
Remove_unused_closure_vars.remove_unused_closure_variables
|
||||
~remove_direct_call_surrogates:false)
|
||||
+-+ ("lift_lets 3", Lift_code.lift_lets)
|
||||
+-+ ("Ref_to_variables",
|
||||
Ref_to_variables.eliminate_ref)
|
||||
|
@ -129,13 +132,17 @@ let middle_end ppf ~source_provenance ~prefixname ~backend
|
|||
Inline_and_simplify.run ~never_inline:true ~backend
|
||||
~prefixname ~round)
|
||||
+-+ ("Remove_unused_closure_vars 3",
|
||||
Remove_unused_closure_vars.remove_unused_closure_variables)
|
||||
Remove_unused_closure_vars.remove_unused_closure_variables
|
||||
~remove_direct_call_surrogates:false)
|
||||
+-+ ("Initialize_symbol_to_let_symbol",
|
||||
Initialize_symbol_to_let_symbol.run)
|
||||
|> loop
|
||||
in
|
||||
let back_end flam =
|
||||
flam
|
||||
+-+ ("Remove_unused_closure_vars",
|
||||
Remove_unused_closure_vars.remove_unused_closure_variables
|
||||
~remove_direct_call_surrogates:true)
|
||||
+-+ ("Lift_constants", Lift_constants.lift_constants ~backend)
|
||||
+-+ ("Share_constants", Share_constants.share_constants)
|
||||
+-+ ("Remove_unused_program_constructs",
|
||||
|
|
|
@ -21,9 +21,6 @@ let register ~pass_name =
|
|||
|
||||
let with_dump ~pass_name ~f ~input ~print_input ~print_output =
|
||||
let dump = Clflags.dumped_pass pass_name in
|
||||
if dump then begin
|
||||
Format.eprintf "Before %s:@ %a@.@." pass_name print_input input
|
||||
end;
|
||||
let result = f () in
|
||||
match result with
|
||||
| None ->
|
||||
|
@ -31,6 +28,7 @@ let with_dump ~pass_name ~f ~input ~print_input ~print_output =
|
|||
None
|
||||
| Some result ->
|
||||
if dump then begin
|
||||
Format.eprintf "Before %s:@ %a@.@." pass_name print_input input;
|
||||
Format.eprintf "After %s:@ %a@.@." pass_name print_output result
|
||||
end;
|
||||
Some result
|
||||
|
|
|
@ -93,6 +93,7 @@ let rewrite_one_set_of_closures (set_of_closures : Flambda.set_of_closures) =
|
|||
~function_decls
|
||||
~free_vars:set_of_closures.free_vars
|
||||
~specialised_args:set_of_closures.specialised_args
|
||||
~direct_call_surrogates:set_of_closures.direct_call_surrogates
|
||||
in
|
||||
Some set_of_closures
|
||||
|
||||
|
|
|
@ -153,6 +153,9 @@ let separate_unused_arguments ~only_specialised
|
|||
let set_of_closures =
|
||||
Flambda.create_set_of_closures ~function_decls
|
||||
~free_vars:set_of_closures.free_vars ~specialised_args
|
||||
(* CR-soon mshinwell: Use direct_call_surrogates for this
|
||||
transformation. *)
|
||||
~direct_call_surrogates:set_of_closures.direct_call_surrogates
|
||||
in
|
||||
Some set_of_closures
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
(** A variable in a closure can either be used by the closure itself
|
||||
or by an inlined version of the function. *)
|
||||
let remove_unused_closure_variables program =
|
||||
let remove_unused_closure_variables ~remove_direct_call_surrogates program =
|
||||
let used_vars_within_closure, used_closure_ids =
|
||||
let used = Var_within_closure.Tbl.create 13 in
|
||||
let used_fun = Closure_id.Tbl.create 13 in
|
||||
|
@ -41,6 +41,12 @@ let remove_unused_closure_variables program =
|
|||
let aux_named _ (named : Flambda.named) : Flambda.named =
|
||||
match named with
|
||||
| Set_of_closures ({ function_decls; free_vars; _ } as set_of_closures) ->
|
||||
let direct_call_surrogates =
|
||||
if remove_direct_call_surrogates then Variable.Set.empty
|
||||
else
|
||||
Variable.Set.of_list
|
||||
(Variable.Map.data set_of_closures.direct_call_surrogates)
|
||||
in
|
||||
let rec add_needed needed_funs remaining_funs free_vars_of_kept_funs =
|
||||
let new_needed_funs, remaining_funs =
|
||||
(* Keep a function if it is used either by the rest of the code,
|
||||
|
@ -49,7 +55,8 @@ let remove_unused_closure_variables program =
|
|||
Variable.Map.partition (fun fun_id _ ->
|
||||
Variable.Set.mem fun_id free_vars_of_kept_funs
|
||||
|| Closure_id.Tbl.mem used_closure_ids
|
||||
(Closure_id.wrap fun_id))
|
||||
(Closure_id.wrap fun_id)
|
||||
|| Variable.Set.mem fun_id direct_call_surrogates)
|
||||
remaining_funs
|
||||
in
|
||||
if Variable.Map.is_empty new_needed_funs then
|
||||
|
@ -96,9 +103,20 @@ let remove_unused_closure_variables program =
|
|||
let free_vars =
|
||||
Flambda_utils.clean_projections ~which_variables:free_vars
|
||||
in
|
||||
let direct_call_surrogates =
|
||||
(* Remove direct call surrogates where either the existing function
|
||||
or the surrogate has been eliminated. *)
|
||||
Variable.Map.fold (fun existing surrogate surrogates ->
|
||||
if not (Variable.Map.mem existing funs)
|
||||
|| not (Variable.Map.mem surrogate funs)
|
||||
then surrogates
|
||||
else Variable.Map.add existing surrogate surrogates)
|
||||
set_of_closures.direct_call_surrogates
|
||||
Variable.Map.empty
|
||||
in
|
||||
let set_of_closures =
|
||||
Flambda.create_set_of_closures ~function_decls
|
||||
~free_vars ~specialised_args
|
||||
~free_vars ~specialised_args ~direct_call_surrogates
|
||||
in
|
||||
Set_of_closures set_of_closures
|
||||
| e -> e
|
||||
|
|
|
@ -17,4 +17,8 @@
|
|||
[@@@ocaml.warning "+a-4-9-30-40-41-42"]
|
||||
|
||||
(** Eliminate variables bound by closures that are not required. *)
|
||||
val remove_unused_closure_variables : Flambda.program -> Flambda.program
|
||||
(* CR mshinwell: update comment, it removes functions too *)
|
||||
val remove_unused_closure_variables
|
||||
: remove_direct_call_surrogates:bool
|
||||
-> Flambda.program
|
||||
-> Flambda.program
|
||||
|
|
|
@ -77,6 +77,7 @@ and value_set_of_closures = {
|
|||
size : int option Variable.Map.t lazy_t;
|
||||
specialised_args : Flambda.specialised_to Variable.Map.t;
|
||||
freshening : Freshening.Project_var.t;
|
||||
direct_call_surrogates : Closure_id.t Closure_id.Map.t;
|
||||
}
|
||||
|
||||
let descr t = t.descr
|
||||
|
@ -187,7 +188,8 @@ let value_closure ?closure_var ?set_of_closures_var ?set_of_closures_symbol
|
|||
|
||||
let create_value_set_of_closures
|
||||
~(function_decls : Flambda.function_declarations) ~bound_vars
|
||||
~invariant_params ~specialised_args ~freshening =
|
||||
~invariant_params ~specialised_args ~freshening
|
||||
~direct_call_surrogates =
|
||||
let size =
|
||||
lazy (
|
||||
let functions = Variable.Map.keys function_decls.funs in
|
||||
|
@ -212,6 +214,7 @@ let create_value_set_of_closures
|
|||
size;
|
||||
specialised_args;
|
||||
freshening;
|
||||
direct_call_surrogates;
|
||||
}
|
||||
|
||||
let update_freshening_of_value_set_of_closures value_set_of_closures
|
||||
|
|
|
@ -159,6 +159,7 @@ and value_set_of_closures = private {
|
|||
specialised_args : Flambda.specialised_to Variable.Map.t;
|
||||
(* Any freshening that has been applied to [function_decls]. *)
|
||||
freshening : Freshening.Project_var.t;
|
||||
direct_call_surrogates : Closure_id.t Closure_id.Map.t;
|
||||
}
|
||||
|
||||
(** Extraction of the description of approximation(s). *)
|
||||
|
@ -179,6 +180,7 @@ val create_value_set_of_closures
|
|||
-> invariant_params:Variable.Set.t Variable.Map.t lazy_t
|
||||
-> specialised_args:Flambda.specialised_to Variable.Map.t
|
||||
-> freshening:Freshening.Project_var.t
|
||||
-> direct_call_surrogates:Closure_id.t Closure_id.Map.t
|
||||
-> value_set_of_closures
|
||||
|
||||
val update_freshening_of_value_set_of_closures
|
||||
|
|
|
@ -18,23 +18,58 @@
|
|||
|
||||
module ASA = Augment_specialised_args
|
||||
module W = ASA.What_to_specialise
|
||||
module E = Inline_and_simplify_aux.Env
|
||||
|
||||
module Transform = struct
|
||||
let pass_name = "unbox-closures"
|
||||
let variable_suffix = ""
|
||||
|
||||
let precondition ~(set_of_closures : Flambda.set_of_closures) =
|
||||
let precondition ~env ~(set_of_closures : Flambda.set_of_closures) =
|
||||
!Clflags.unbox_closures
|
||||
&& not (E.at_toplevel env)
|
||||
&& not (Variable.Map.is_empty set_of_closures.free_vars)
|
||||
|
||||
let what_to_specialise ~env:_ ~(set_of_closures : Flambda.set_of_closures) =
|
||||
let what_to_specialise ~env ~(set_of_closures : Flambda.set_of_closures) =
|
||||
let what_to_specialise = W.create ~set_of_closures in
|
||||
if not (precondition ~set_of_closures) then
|
||||
if not (precondition ~env ~set_of_closures) then
|
||||
what_to_specialise
|
||||
else
|
||||
else begin
|
||||
let round = E.round env in
|
||||
let num_closure_vars = Variable.Map.cardinal set_of_closures.free_vars in
|
||||
let module B = Inlining_cost.Benefit in
|
||||
let saved_by_not_building_closure =
|
||||
(* For the moment assume that we're going to cause all functions in the
|
||||
set to become closed. *)
|
||||
B.remove_prims (B.remove_call B.zero) num_closure_vars
|
||||
in
|
||||
Flambda_iterators.fold_function_decls_ignoring_stubs set_of_closures
|
||||
~init:what_to_specialise
|
||||
~f:(fun ~fun_var ~function_decl:_ what_to_specialise ->
|
||||
~f:(fun ~fun_var ~(function_decl : Flambda.function_declaration)
|
||||
what_to_specialise ->
|
||||
let body_size = Inlining_cost.lambda_size function_decl.body in
|
||||
(* If the function is small enough, make a direct call surrogate
|
||||
for it, so that indirect calls are not penalised by having to
|
||||
bounce through the stub. (Making such a surrogate involves
|
||||
duplicating the function.) *)
|
||||
let small_enough_to_duplicate =
|
||||
let module W = Inlining_cost.Whether_sufficient_benefit in
|
||||
let wsb =
|
||||
W.create_estimate ~original_size:0
|
||||
~toplevel:false
|
||||
~branch_depth:0
|
||||
~new_size:((body_size / !Clflags.unbox_closures_factor) + 1)
|
||||
~benefit:saved_by_not_building_closure
|
||||
~lifting:false
|
||||
~round
|
||||
in
|
||||
W.evaluate wsb
|
||||
in
|
||||
let what_to_specialise =
|
||||
if small_enough_to_duplicate then
|
||||
W.make_direct_call_surrogate_for what_to_specialise ~fun_var
|
||||
else
|
||||
what_to_specialise
|
||||
in
|
||||
let bound_by_the_closure =
|
||||
Flambda_utils.variables_bound_by_the_closure
|
||||
(Closure_id.wrap fun_var)
|
||||
|
@ -46,6 +81,7 @@ module Transform = struct
|
|||
~definition:(Existing_inner_free_var inner_free_var))
|
||||
bound_by_the_closure
|
||||
what_to_specialise)
|
||||
end
|
||||
end
|
||||
|
||||
include ASA.Make (Transform)
|
||||
|
|
|
@ -21,5 +21,12 @@
|
|||
|
||||
val rewrite_set_of_closures
|
||||
: env:Inline_and_simplify_aux.Env.t
|
||||
(* CR-soon mshinwell: eliminate superfluous parameter *)
|
||||
-> duplicate_function:(
|
||||
env:Inline_and_simplify_aux.Env.t
|
||||
-> set_of_closures:Flambda.set_of_closures
|
||||
-> fun_var:Variable.t
|
||||
-> Flambda.function_declaration
|
||||
* Flambda.specialised_to Variable.Map.t)
|
||||
-> set_of_closures:Flambda.set_of_closures
|
||||
-> (Flambda.expr * Inlining_cost.Benefit.t) option
|
||||
|
|
|
@ -158,6 +158,7 @@ let run ~env ~(set_of_closures : Flambda.set_of_closures) =
|
|||
~function_decls:set_of_closures.function_decls
|
||||
~free_vars
|
||||
~specialised_args:set_of_closures.specialised_args
|
||||
~direct_call_surrogates:set_of_closures.direct_call_surrogates
|
||||
in
|
||||
let expr, benefit =
|
||||
add_lifted_projections_around_set_of_closures ~set_of_closures
|
||||
|
|
|
@ -38,5 +38,12 @@
|
|||
|
||||
val rewrite_set_of_closures
|
||||
: env:Inline_and_simplify_aux.Env.t
|
||||
(* CR-soon mshinwell: eliminate superfluous parameter *)
|
||||
-> duplicate_function:(
|
||||
env:Inline_and_simplify_aux.Env.t
|
||||
-> set_of_closures:Flambda.set_of_closures
|
||||
-> fun_var:Variable.t
|
||||
-> Flambda.function_declaration
|
||||
* Flambda.specialised_to Variable.Map.t)
|
||||
-> set_of_closures:Flambda.set_of_closures
|
||||
-> (Flambda.expr * Inlining_cost.Benefit.t) option
|
||||
|
|
|
@ -118,6 +118,7 @@ module Options = Main_args.Make_optcomp_options (struct
|
|||
let _shared = option "-shared"
|
||||
let _thread = option "-thread"
|
||||
let _unbox_closures = option "-unbox-closures"
|
||||
let _unbox_closures_factor = option_with_int "-unbox-closures"
|
||||
let _unsafe = option "-unsafe"
|
||||
let _unsafe_string = option "-unsafe-string"
|
||||
let _v = option "-v"
|
||||
|
|
|
@ -123,6 +123,7 @@ module Options = Main_args.Make_opttop_options (struct
|
|||
use_inlining_arguments_set ~round:0 o1_arguments
|
||||
let _remove_unused_arguments = set remove_unused_arguments
|
||||
let _unbox_closures = set unbox_closures
|
||||
let _unbox_closures_factor f = unbox_closures_factor := f
|
||||
let _drawclambda = set dump_rawclambda
|
||||
let _dclambda = set dump_clambda
|
||||
let _drawflambda = set dump_rawflambda
|
||||
|
|
|
@ -169,7 +169,7 @@ let inline_toplevel_multiplier = 16
|
|||
let default_inline_toplevel_threshold =
|
||||
int_of_float ((float inline_toplevel_multiplier) *. default_inline_threshold)
|
||||
let default_inline_call_cost = 5
|
||||
let default_inline_alloc_cost = 3
|
||||
let default_inline_alloc_cost = 7
|
||||
let default_inline_prim_cost = 3
|
||||
let default_inline_branch_cost = 5
|
||||
let default_inline_indirect_cost = 4
|
||||
|
@ -201,6 +201,9 @@ let inline_max_depth =
|
|||
let unbox_specialised_args = ref true (* -no-unbox-specialised-args *)
|
||||
let unbox_free_vars_of_closures = ref true
|
||||
let unbox_closures = ref false (* -unbox-closures *)
|
||||
let default_unbox_closures_factor = 10
|
||||
let unbox_closures_factor =
|
||||
ref default_unbox_closures_factor (* -unbox-closures-factor *)
|
||||
let remove_unused_arguments = ref false (* -remove-unused-arguments *)
|
||||
|
||||
type inlining_arguments = {
|
||||
|
|
|
@ -182,6 +182,8 @@ val opaque : bool ref
|
|||
val print_timings : bool ref
|
||||
val flambda_invariant_checks : bool ref
|
||||
val unbox_closures : bool ref
|
||||
val unbox_closures_factor : int ref
|
||||
val default_unbox_closures_factor : int
|
||||
val unbox_free_vars_of_closures : bool ref
|
||||
val unbox_specialised_args : bool ref
|
||||
val clambda_checks : bool ref
|
||||
|
|
Loading…
Reference in New Issue