On Wed, May 5, 2010 at 9:47 PM, Matthew Mondor <span dir="ltr"><<a href="mailto:mm_lists@pulsar-zone.net">mm_lists@pulsar-zone.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Considering the code in c/num_arith.d all using cases on the cl_object<br>
type, does this also mean that currently the compiler couldn't optimize<br>
to use type-specific inline operations even if it made use of good<br>
static type analysis? Or can the compiler also generate inline code<br>
which doesn't use these functions?<br></blockquote><div><br>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.<br>
<br>For example in the code below ECL unboxes the value of X and does all other operations in floating point and integer arithmetics.<br><br>> (disassemble<br> '(lambda (x)<br> (declare (fixnum x))<br> (let ((y (/ x 2))<br>
(z (- x 1)))<br> (declare (fixnum z y))<br> (< y z))))<br><br>static cl_object L1c__gazonk(cl_object V1)<br>{ VT2 VLEX2 CLSR2 STCK2<br> const cl_env_ptr cl_env_copy = ecl_process_env();<br>
cl_object value0;<br> ecl_cs_check(cl_env_copy,value0);<br> {<br> cl_fixnum V2;<br> V2= ecl_to_fixnum(V1);<br> [... expensive and currently inefficient type checks for X ...]<br> {cl_fixnum V3;<br> V3= (V2)/(2);<br>
{cl_fixnum V4;<br> V4= (V2)-(1);<br> value0=ecl_make_bool((V3)<(V4)); cl_env_copy->nvalues=1;<br> return value0;}}<br>}}<br><br>Juanjo<br><br></div></div>-- <br>Instituto de Física Fundamental, CSIC<br>
c/ Serrano, 113b, Madrid 28006 (Spain) <br><a href="http://tream.dreamhosters.com">http://tream.dreamhosters.com</a><br>