caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain.frisch@lexifi.com>
To: Mark Shinwell <mshinwell@janestreet.com>,
	Gerd Stolpmann <info@gerd-stolpmann.de>
Cc: Pierre Chambart <pierre.chambart@laposte.net>,
	Markus Mottl <markus.mottl@gmail.com>,
	OCaml List <caml-list@inria.fr>
Subject: Re: [Caml-list] <DKIM> Re: Status of Flambda in OCaml 4.03
Date: Fri, 11 Mar 2016 10:09:51 +0100	[thread overview]
Message-ID: <56E28B5F.2030002@lexifi.com> (raw)
In-Reply-To: <CAM3Ki76Fe-A2+nxaZeZt3rQ8P3m-wh9FmAsyoQ2Qp7WedUcoRA@mail.gmail.com>

On 11/03/2016 09:59, Mark Shinwell wrote:
> Also, for a function like the one you gave containing:
>
>    if <cond> then <small expr> else <big expr>
>
> one of the reasons this should be kept in the .cmx files is because,
> when the compiler comes to examine whether to inline it, it may be
> able to fully evaluate <cond>.  In particular when it's true then the
> large expression can be eliminated completely (so long as <cond> is
> not side-effecting).  Another example is functions containing a large
> match, where we may end up knowing which case is to be taken.

For such cases, it is interesting to compile the function as a small 
stub that checks the condition or the match and jumps (tail call) into 
the proper sub-body.  Only the stub (and potentially small enough 
sub-bodies) would be inlined, and the cmx would not need to store the 
large sub-bodies.  Such approach was already taken for optional 
arguments, and I think that flambda already generalizes it.  Would the 
case above be treated like that?


Alain

  parent reply	other threads:[~2016-03-11  9:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08 22:10 [Caml-list] " Markus Mottl
2016-03-08 22:53 ` Alain Frisch
2016-03-09  3:55   ` Markus Mottl
2016-03-09  7:14     ` Mark Shinwell
2016-03-10  0:59       ` Markus Mottl
2016-03-10  1:32         ` Yotam Barnoy
2016-03-10  1:43           ` Markus Mottl
2016-03-10  7:20             ` Mark Shinwell
2016-03-10 15:32               ` Markus Mottl
2016-03-10 15:49                 ` Gabriel Scherer
2016-04-17  8:43                   ` Jesper Louis Andersen
2016-04-17  8:59                     ` Mohamed Iguernlala
2016-04-17 15:43                       ` Markus Mottl
2016-03-10 20:12                 ` [Caml-list] <DKIM> " Pierre Chambart
2016-03-10 21:08                   ` Markus Mottl
2016-03-10 22:51                   ` Gerd Stolpmann
2016-03-11  8:59                     ` Mark Shinwell
2016-03-11  9:05                       ` Mark Shinwell
2016-03-11  9:09                       ` Alain Frisch [this message]
2016-03-11  9:26                         ` Mark Shinwell
2016-03-11 14:48                           ` Yotam Barnoy
2016-03-11 15:09                             ` Jesper Louis Andersen
2016-03-11 16:58                       ` Markus Mottl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56E28B5F.2030002@lexifi.com \
    --to=alain.frisch@lexifi.com \
    --cc=caml-list@inria.fr \
    --cc=info@gerd-stolpmann.de \
    --cc=markus.mottl@gmail.com \
    --cc=mshinwell@janestreet.com \
    --cc=pierre.chambart@laposte.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).