[Ecls-list] A few compiled results questions

Juan Jose Garcia-Ripoll juanjose.garciaripoll at gmail.com
Tue Oct 29 21:59:50 UTC 2013

On Tue, Oct 29, 2013 at 3:06 AM, Matthew Mondor <mm_lists at pulsar-zone.net>wrote:

> First a question relative to LOOP/LET and FIXNUM:

Actually nothing to do with LOOP. Replace LET -> LET* and you will see
better optimizations. The problem is that LET misses some declarations that
LET* has. Take

(LET ((A (FOO))) (DECLARE (FIXNUM A)) ...)

Internally, ECL converts this into

(LET* ((X (FOO)) (A X)) (DECLARE (FIXNUM A)) ...)

Now, since "A" is read only, it is replaced by the value X, which was not
declared to be a FIXNUM. One could fix the transformer for LET to add a
declaration on the temporary variables or, more simply, add (THE FIXNUM
...) around the value.

> This next question has to do with structure accessors:
> As can be seen above, a function dispatch is done to access the slots in
> read mode.  But interestingly, for SETF, a more inline result is
> obtained assigning directly on the slot:[...]
> I realize that with CLOS this would be more complex, but this is a
> simple struct, with the consequences voluntarily undefined if it's
> redefined without recompiling its dependent code.  Could it be that
> SETF can infer better than LET in this case?  Or is there another
> reason why inline read slot access should not be done here, but that
> it's safer for SETF?

Not really. Both should be equivalent for structures but the difference is
that SETF has an analyzer for that, but ordinary function calls do not
check whether the function names a slot accessor -- the code is there, but
it is deactivated because it cannot be used with CLOS.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20131029/d73813e3/attachment.html>

More information about the ecl-devel mailing list