<div dir="ltr">Hi Tito,<div><br></div><div>first of all thanks for your interest in the project.<div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 3, 2013 at 10:56 AM, Tito Latini <span dir="ltr"><<a href="mailto:tito.01beta@gmail.com" target="_blank">tito.01beta@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I would appreciate any suggestions about portable COMPARE-AND-SWAP and<br>
memory barrier facilities. In the past I used non-portable code<br>
inlined in C.<br></blockquote><div><br></div><div>You still can use inline C versions, but I would like to include C-A-S in ECL as well -- the problem being that since I do not know which API would be best (small but still useful), this is not yet implemented.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In my code, the expansion of the definition of a synth is a big block<br>
(here is an example: [2]). The generated code is optimized in SBCL and<br>
there is not garbage during the performance. It is a great success. I<br>
would like to know if the procedures to get cons-free code are similar<br>
or if you could point me towards the right direction (links to existent<br>
efficient code are useful).</blockquote><div><br></div><div>I do not see why/how your code is cons-free. I see a lot of structures, lists, closures being constructed, so it is really hard to see how indeed it is going to execute cons-free at run time. I see, however, several problems.</div>
<div><br></div><div>One is that you do not declare certain variables, such as the ones in with-foreign-symbols. I presume this expands to a LET form, but uninitialized LET forms (as in (LET (A) (SETF A 4.0d0))) prevent ECL from inferring the type of the variable -- it is always of type T, as it is assigned NIL at the beginning, following the standard.</div>
<div><br></div><div>CLOS is also significantly slower than structures, or even access to arrays and lists. Avoid it unless needed, or define the classes to be of sealed type.</div><div><br></div><div>There may be other subtleties in the mathematical operations, ECL probably not being able to infer the type of all of them if the arguments are integers -- for doubles/floats it propagates types properly because it is simpler.</div>
<div><br></div><div>Unfortunately there is not a list of rules, as the compiler is continuously evolving, but DISASSEMBLE will help you in knowing what type of code is actually being produced.</div><div><br></div><div>Juanjo</div>
</div><div><br></div>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br><a href="http://juanjose.garciaripoll.googlepages.com" target="_blank">http://juanjose.garciaripoll.googlepages.com</a>
</div></div></div>