From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id D1216BBAF for ; Thu, 20 May 2010 10:41:52 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtcBAHqS9EtKfVI0mGdsb2JhbACdHl0IFQEBAQEBCAkMBxEirDmCAYUfLohOAQEDBYJpCIIcBA X-IronPort-AV: E=Sophos;i="4.53,270,1272837600"; d="scan'208";a="50929426" Received: from mail-ww0-f52.google.com ([74.125.82.52]) by mail3-smtp-sop.national.inria.fr with ESMTP; 20 May 2010 10:41:52 +0200 Received: by wwb22 with SMTP id 22so1299817wwb.39 for ; Thu, 20 May 2010 01:41:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=OTpfEXQEst+L8QdZKn/j7DwJzZrsbsddc8HH+1SYVqs=; b=TWCP0ka5Zlzv80gFcLEi8o5d2arUF9HnvY9j5YrcUFahmXalHkwY2StE9zjcZg3lEW 47aggFqquJ/SFnXAba2JDis5ypNJU23SCEb8UBWkFU3RLoUteblHYHqTam8y8quagnhZ TdUTb1JiEplOjvcCHVsIr2r5xshN5erRvFCHI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=QguQdHsCe7gahpyH6sA5kma5NrURcJi9y1s8z4Wx2zEcfeD170P9KVxo2+JIShnHIs qpPNufR94bUedZFuOjzZtsKvrlTEMeTCzBEQ7Su3SY/3baecf0X48/yphFb42zH5Y3uY Ck9RVZcSrUMW0+3BO1gNIJhcJrRpcY/R0uF+g= MIME-Version: 1.0 Received: by 10.216.158.1 with SMTP id p1mr5916796wek.202.1274344910101; Thu, 20 May 2010 01:41:50 -0700 (PDT) Received: by 10.216.181.65 with HTTP; Thu, 20 May 2010 01:41:49 -0700 (PDT) In-Reply-To: <4BF3E071.9040901@gmail.com> References: <4BF3E071.9040901@gmail.com> Date: Thu, 20 May 2010 10:41:49 +0200 Message-ID: Subject: Re: [Caml-list] OCaml defunctorization and other optimizations From: Julien Signoles To: =?ISO-8859-1?Q?T=F6r=F6k_Edwin?= Cc: caml-list@yquem.inria.fr Content-Type: multipart/alternative; boundary=0016e649c490b01e4a0487028b64 X-Spam: no; 0.00; ocaml:01 signoles:01 signoles:01 ocaml:01 camlp:01 camlp:01 recursive:01 recursive:01 compiler:01 compiler:01 edwin:98 edwin:98 syntactic:01 syntactic:01 typing:01 --0016e649c490b01e4a0487028b64 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello, 2010/5/19 T=F6r=F6k Edwin > 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, but I have no time from a while ago in order to implement myself a new version of ocamldefun. I could provide some helps to someone motivated... 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 t= o 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, bu= t defunctorisation requires to manipulate the full caml AST. > 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? > 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. Hope this helps, Julien --0016e649c490b01e4a0487028b64 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello,

2010/5/19 T=F6r=F6k Edwin <edw= intorok@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 n= o 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 partic= ular the new caml constructs like recursive modules).

Besides ocamld= efun could be hugely improved in order to generate more efficient caml code= . I know (I knew?) what to do for this purpose, but I have no time from a w= hile ago in order to implement myself a new version of ocamldefun. I could = provide some helps to someone motivated...

Is it possible to implement ocamldefun-like functionality via Camlp4's<= br> 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 defunctorisati= on requires to manipulate the full caml AST.
=A0
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?=A0
=A0
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 coul= d embed some parts of the caml compiler in your tool.

Hope this helps,
Julien
--0016e649c490b01e4a0487028b64--