From: "Török Edwin" <edwintorok@gmail.com>
To: Julien Signoles <julien.signoles@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] OCaml defunctorization and other optimizations
Date: Thu, 20 May 2010 14:15:48 +0300 [thread overview]
Message-ID: <4BF519E4.8040402@gmail.com> (raw)
In-Reply-To: <AANLkTindtOMcmiPn_6EmWIzLdp68YaRDVkGNJRy0GZ_S@mail.gmail.com>
On 05/20/2010 11:41 AM, Julien Signoles wrote:
> Hello,
>
> 2010/5/19 Török Edwin <edwintorok@gmail.com <mailto:edwintorok@gmail.com>>
>
> I was able to find the sources via the wayback machine.
> Unsurprisingly it doesn't build with OCaml 3.11.2 (it wants OCaml 3.06).
> Is there a more up to date variant of ocamldefun? Would it be possible
> to port it to 3.11.2?
>
>
> As far as I know, there is no up to date variant of ocamldefun.
> For porting to 3.11.2, you have at least to:
> - update the caml AST
> - migrate all the camlp4 stuff to new camlp4 or camlp5
> - update the different analyses to take into account AST changes (in
> particular the new caml constructs like recursive modules).
>
> Besides ocamldefun could be hugely improved in order to generate more
> efficient caml code. I know (I knew?) what to do for this purpose
Thanks, this sounds good so far.
>, but I
> have no time from a while ago in order to implement myself a new version
> of ocamldefun.
Yes time is an issue for me too.
> I could provide some helps to someone motivated...
I think that'll have to be someone else than me, as I consider myself
just a beginner in OCaml.
However if you think that implementing AST transforms would be possible
for a beginner (in OCaml, I do have experience with compilers), I'm
willing to give it a try.
>
> Is it possible to implement ocamldefun-like functionality via Camlp4's
> AST filters?
>
>
> Defunctorisation is a fully syntactic task (that's not so true in
> presence of recursive modules). But, among other thinks,
> defunctorisation requires to perform the very same scope analysis than
> ocaml for binding each use of variable to its declaration. I am not an
> expert of Camlp4 possibilities, but defunctorisation requires to
> manipulate the full caml AST.
It looks like there is access to AST, I don't know if it is the full AST
or just a simplified view:
http://brion.inria.fr/gallium/index.php/Abstract_Syntax_Tree
http://brion.inria.fr/gallium/index.php/Camlp4MapGenerator
>
>
> Also is it possible to implement function specialization
> (monomorphization?) using an AST filter?
> The example from the OCaml tutorial is not optimized by
> http://www.ocaml-tutorial.org/performance_and_profiling.
>
>
> I'm not an expert (again) but typing information should be required,
> isn't it?
Right, so I would need an AST that has all the infered type information.
I don't know if Camlp4 can offer that.
>
>
> Or is it possible to get access to the OCaml compiler's IL
> representation and make optimizations on that?
>
>
> At this day, there is no public interface to the internal modules of the
> caml compiler. But, depending on the context (possible license issues),
> you could embed some parts of the caml compiler in your tool.
I think that if there is a defunctorizer written it should live in the
OCaml distribution itself (maybe in contrib/).
I certainly don't intend to write an external tool that uses OCaml
internal modules.
Best regards,
--Edwin
next prev parent reply other threads:[~2010-05-20 11:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-19 12:58 Török Edwin
2010-05-20 8:41 ` [Caml-list] " Julien Signoles
2010-05-20 11:15 ` Török Edwin [this message]
2010-05-20 11:40 ` Julien Signoles
2010-05-20 12:04 ` Török Edwin
2010-05-20 13:16 ` Maxence Guesdon
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=4BF519E4.8040402@gmail.com \
--to=edwintorok@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=julien.signoles@gmail.com \
/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