Conversation
|
The problem is in the new unboxing strategy in cmmgen (see my email to caml-devel this morning), which currently wrongly interprets constants as boxing constructions. This should be easy to fix, and I think it's a better place than in flambda-specific passes. |
|
Even with fixes to |
|
As this is not obvious in leo's comment, since flambda try quite aggressively to share constants, writing will also result in the same code. The change is simple and mix well with the 'spirit' of this pass and fix some flambda specific problem, so I think this is ok to be flambda specific here. |
|
I think Un_anf should probably have been able to cope with variables used non-linearly (when appropriate, e.g. when bound to a constant) in the first place, so this patch seems appropriate. I have not yet checked the details. |
|
This applies to all kinds of constants. We may want to restrict this to some. |
|
@chambart We think this can go into 4.04. What do you want to do about your comment about restricting to certain varieties of constants? |
|
@mshinwell @lpw25 , No this is not really important. This can be accepted as it is |
|
I forgot to mark this as approved before, here it is ! |
e0222f2 to
10ebc10
Compare
Simplify some of the minor_gc code
Import middle_end/flambda2 from ocaml-flambda/ocaml rev 068eb9f (Fexpr support for rec info, coercions (ocaml#567)) squashed with the following fixes (from mshinwell/flambda-backend branch import-flambda2): * Fix inlining attributes in middle_end/flambda2/compilenv_deps/patricia_tree.ml * Fix inlining attributes in middle_end/flambda2/naming/name_abstraction.ml * Update Lambda_conversions to cope with the removal of the size+tag propagation * dune file fixes for Flambda 2 compilation in the Flambda backend * Stub out Flambda_features temporarily * Fixes for Immutable_unique and tag/size removal patch * is_c_builtin * probes * Support for probes and C builtins (as used for intrinisics) * Removal of Double_u, use Double instead * Use exhaustive match in close_c_call * menhir version change in middle_end/flambda2/parser/flambda_parser.ml * Avoid Location.print_compact * Avoid Lambda.print_scoped_location
Import middle_end/flambda2 from ocaml-flambda/ocaml rev 068eb9f (Fexpr support for rec info, coercions (ocaml#567)) squashed with the following fixes (from mshinwell/flambda-backend branch import-flambda2): * Fix inlining attributes in middle_end/flambda2/compilenv_deps/patricia_tree.ml * Fix inlining attributes in middle_end/flambda2/naming/name_abstraction.ml * Update Lambda_conversions to cope with the removal of the size+tag propagation * dune file fixes for Flambda 2 compilation in the Flambda backend * Stub out Flambda_features temporarily * Fixes for Immutable_unique and tag/size removal patch * is_c_builtin * probes * Support for probes and C builtins (as used for intrinisics) * Removal of Double_u, use Double instead * Use exhaustive match in close_c_call * menhir version change in middle_end/flambda2/parser/flambda_parser.ml * Avoid Location.print_compact * Avoid Lambda.print_scoped_location
Signed-off-by: Paul-Elliot <[email protected]> Co-authored-by: Christine Rose <[email protected]>
For code like:
Flambda will currently produce clambda equivalent to:
which, because of how unboxing now works, causes
yto be unboxed and then re-boxed for both calls tofoo.This patch changes how flambda is converted to clambda, so that we instead get clambda like:
which avoids the unnecessary allocation.