Version française
Home     About     Download     Resources     Contact us    
Browse thread
O'Caml native code can be easily improved in size by 10%
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: O'Caml native code can be easily improved in size by 10%
> [Combining heap allocations inside one basic block]

This is an excellent idea.  (I considered it briefly a long time ago,
while working on Gallium, an early precursor of the OCaml native-code
compiler, but the effects weren't really significant on the small
benchmarks that I used then.)

I'll implement it a bit differently than in your patch: instead of
grouping the allocations late (in Linearize), I'd rather group them
during instruction selection (Selectgen).  One advantage is that the
optimization you describe (not reading youg_ptr again for each
sub-allocation) then comes "for free".  Another advantage is that we
don't need to modify all code emitters...

> And the last: on x86 and m68k architectures `selection.ml' contains the
> following method:
> the alternative
>     Cconst_int n -> (Ispecific(Istore_int(n, addr)), Ctuple [])
> processes storing of the Cconst_int immediate constants, but ignores the  
> Cconst_natint constants.

Good point.  I guess this part of the code wasn't updated when
"big constants" (Cconst_natint) were introduced.  The right thing to
do is to put a Nativeint.t, not an int, as argument of Istore_int
and Ipush_int.

All this will be in 2.02.  Combined with other optimizations I'm
working on, 2.02 should show some significant improvements in
execution speed and code size.

Thanks for your feedback,

- Xavier Leroy