[Ecls-list] ECL as an embedded language on an Android game

Anton Vodonosov avodonosov at yandex.ru
Thu Jul 11 13:31:37 UTC 2013

11.07.2013, 16:40, "Juan Jose Garcia-Ripoll" <juanjose.garciaripoll at gmail.com>:
> On Thu, Jul 11, 2013 at 2:04 PM, Anton Vodonosov <avodonosov at yandex.ru> wrote:
>> I think (hope) there are not so many places in CL which allow to couple the code with the host compiler.
>> Maybe this example with most-postivive-fixnum (-negative-long-float, etc) is the only one?
>> If so, it must be very very rare case.
> It is not so rare. Take for instance code that uses type comparisons. A macro may evaluate its constant arguments to determine whether they are of type fixnum and this result depends on the platform. I am pretty sure that those checks are quite pervasive in the libraries out there. There is also code that checks for the existence of certain specialized arrays (clx most notably) and creates buffers and constants based on that decision. This once more demands that target and host be tightly coupled: i.e. similar endianness, word size, etc.
> What I mean is that people write code based on the assumption that they can, at runtime, learn things about the platform they will run on. If the target and host are quite different, these compile-time assumptions will be broken.
> Of course those assumptions can be parameterized in the library, but this cannot be automated by the platform that runs the compiler (ECL)
> Juanjo

Maybe it is impossible to give a 100% guarantee to cross compile any CL code.
But I guess more than 93% of useful libraries are not affected but such issues and
can be cross-compiled as is, without even tuning them.

I am curious to know what are the specialized arrays? (used in clx)?

Note, that the target has the same runtime library - ECL.
So the most troublesome things for cross compilation are properties
of the underlying platform that are visible through the CL;
not the properties of the given CL implementation.

And the underlying platform is abstracted very much by CL.
Endiannes is abstracted by function cl:ldb - zero byte is the less significant
byte of an integer, doesn't matter how the integer layed out in memory.

So I still think cross-compilation of Lisp code has significant potential.
Mocl is even trying to make business on it.

On the other hand, it is not always necessary. Loading the system
from source code on target and running interpretter may be OK for many applications.

Best regards,
- Anton

More information about the ecl-devel mailing list