Hi Tito,

first of all thanks for your interest in the project.

On Wed, Jul 3, 2013 at 10:56 AM, Tito Latini <tito.01beta@gmail.com> wrote:
I would appreciate any suggestions about portable COMPARE-AND-SWAP and
memory barrier facilities. In the past I used non-portable code
inlined in C.

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.

In my code, the expansion of the definition of a synth is a big block
(here is an example: [2]). The generated code is optimized in SBCL and
there is not garbage during the performance. It is a great success. I
would like to know if the procedures to get cons-free code are similar
or if you could point me towards the right direction (links to existent
efficient code are useful).

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.

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.

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.

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.

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.


Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)