Re: O'Caml native code can be easily improved in size by 10%

From: Xavier Leroy (Xavier.Leroy@inria.fr)
Date: Thu Feb 04 1999 - 15:05:59 MET


Date: Thu, 4 Feb 1999 15:05:59 +0100
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Anton Moscal <msk@post.tepkom.ru>, caml-list@inria.fr
Subject: Re: O'Caml native code can be easily improved in size by 10%
In-Reply-To: <Pine.LNX.4.03.9902021757050.1195-101000@post.tepkom.ru>; from Anton Moscal on Tue, Feb 02, 1999 at 06:06:14PM +0300

> [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



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:19 MET