Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] O'Caml vs C++: a little benchmark
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: malc <malc@p...>
Subject: Re: [Caml-list] Inlining across functors (was: O'Caml vs C++: a little benchmark)
On Tue, 20 Aug 2002, malc wrote:

> On Mon, 19 Aug 2002, Thorsten Ohl wrote:
> 
> > Xavier Leroy <xavier.leroy@inria.fr> writes:
> > 
> > > Just for the record: ocamlopt does perform inlining across
> > > compilation units (via the information stored in .cmx files).  What
> > > it doesn't do, however, is inlining and specialization of recursive
> > > function definitions.
> > 
> > However, it appears that it doesn't inline across functors.  For
> > example, in
> snip
> > 
> > Is this because the signature M can make no guarantee that op is never
> > a recursive function? Do all functor applications fall under the `no
> > inlining and specialization of recursive function definitions' clause?
> 
> Yes. With http://algol.prosalg.no/~malc/code/patches/specfun.tar.gz 
> (patch against 3.04) you will get this instead:
> 
> *** Linearized code                                                             
> Opt_f2_72:                                                                      
>   A/11[%ecx] := [env/10[%ecx] + 12]                                             
>   A/12[%ecx] := [A/11[%ecx]]                                                    
>   tailcall "Opt_f_62" R/0[%eax]                                                 
>   R/1[%ebx]                                                                     
>   R/2[%ecx]   
Whoops.. Again a reminder to think before posting.. The real linearized 
code with specfun would be:

*** Linearized code                                                             
Opt_f_76:                                                                       
  n/10[%eax] := a/8[%eax] + b/9[%ebx] + -1                                      
  return R/0[%eax]                                                              
                                                                                
*** Linearized code                                                             
Opt_f2_84:                                                                      
  n/10[%eax] := a/8[%eax] + b/9[%ebx] + -1                                      
  return R/0[%eax]

(Forgot to specify -specialize on command line.. doh)

-- 
mailto:malc@pulsesoft.com

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners