[Ecls-list] Megapatches ahead

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Wed May 5 20:00:45 UTC 2010


On Wed, May 5, 2010 at 9:47 PM, Matthew Mondor <mm_lists at pulsar-zone.net>wrote:

> Considering the code in c/num_arith.d all using cases on the cl_object
> type, does this also mean that currently the compiler couldn't optimize
> to use type-specific inline operations even if it made use of good
> static type analysis? Or can the compiler also generate inline code
> which doesn't use these functions?
>

Those functions are only used when the type of the arguments or of the
output is not known or it does not match any of the C integer and floating
point types.

For example in the code below ECL unboxes the value of X and does all other
operations in floating point and integer arithmetics.

> (disassemble
    '(lambda (x)
      (declare (fixnum x))
      (let ((y (/ x 2))
            (z (- x 1)))
        (declare (fixnum z y))
        (< y z))))

static cl_object L1c__gazonk(cl_object V1)
{ VT2 VLEX2 CLSR2 STCK2
    const cl_env_ptr cl_env_copy = ecl_process_env();
    cl_object value0;
    ecl_cs_check(cl_env_copy,value0);
    {
    cl_fixnum V2;
    V2= ecl_to_fixnum(V1);
   [... expensive and currently inefficient type checks for X ...]
    {cl_fixnum V3;
    V3= (V2)/(2);
    {cl_fixnum V4;
    V4= (V2)-(1);
    value0=ecl_make_bool((V3)<(V4)); cl_env_copy->nvalues=1;
    return value0;}}
}}

Juanjo

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://tream.dreamhosters.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20100505/d69833af/attachment.html>


More information about the ecl-devel mailing list