[Aldor-l] [fricas-devel] Re: aldor fricas interoperability... call for testers
Ralf Hemmecke
ralf at hemmecke.de
Fri Aug 8 09:45:25 EDT 2008
>> I must say, if in Axiom appears anything that blindly assumes that SInt is 32
>> or at least 31 bits, must be considered as a bug. I doubt that there is a
>> clear specification for Axiom's SInt. Or is there?
>
> No, it's aldor that assumes 32 bits for SInts, I believe.
No, not "assumes", but (nearly) specifies. It doesn't say anything about
the bitsize, though. But in the AUG page 149, you find:
=====
XByte, HInt, SInt, BInt: Type
These are integer types of various sizes. The types XByte, HInt,
SInt are unsigned byte, half-precision and single-precision
integer types, capable of representing values in at least the
ranges 0 to 255, -32767 to 32767 and -2147483647 to 2147483647,
respectively. The type BInt provides a "big" integer type, which,
in principle, may be of any size. In practice, the size will be
limited by considerations such as the amount of memory available
to a program.
=====
So Aldor's SInt must have >= 32 bit. But it doesn't say =32bit. Not even
does it specify that it must be a binary representation. So in order to
work correctly, you must look up the Aldor compiler code for SInt.
In trunk/aldor/aldor/lib/libfoam/foam_s.scm,
There is
(deftype |SInt| () 'fixnum)
and some other things related to SInt.
Similar in aldor/lib/libfoam/foam_l.lsp.
Then there is
typedef long FiSInt;
in aldor/lib/libfoam/links/foam_c.
I see actually no problem with your change to 32 bits, since it sees
that foam alone makes the connection to the actual bitsize.
But you patch is incomplete.
There are also the places:
(defmacro |SIntMin| () `(the |SInt| most-negative-fixnum))
(defmacro |SIntMax| () `(the |SInt| most-positive-fixnum))
where fixnum seems to be involved.
I must say, I would actually rather like to keep the definitions that
way. SBCL should rather provide fixnum with >=32 bits to be able to work
together with Aldor.
So I think, your patch is a hack. Is there somehow explained what
bitsize 'fixnum' has?
>> Another thing is, if I grep the fricas sources, I only find |SInt| in
>>
>> src/interp/axext_l.lisp
>> src/interp/sys-pkg.lisp
>> src/interp/foam_l.lisp
>> src/interp/interp-proclaims.lisp
>>
>> So I believe the modification you suggest above should work at least for 32
>> bit machines. Simply since Axiom does not know SInt, only foam knows.
>
> Oh, this is very good news! So, it's actually sufficient to check that Aldor
> does not convert axiom's "SingleInteger"s into "SInt"s, which is unlikely, I
> guess.
Uff. I have no idea, what the compiler does. But I think the
representation of SInt coming from Aldor should be identical with the
representation of SingleInteger in Axiom. So what is the representation
of SingleInteger in Axiom? Don't say 'fixnum'... ;-)
>> So I would be much more happy if the patch is somehow coordinated with the
>> foam definitions in the Aldor compiler and thus perhaps be conditional
>> depending on the bit size of the machine.
>
> I'm guessing that the Aldor compiler currently just uses 32 bits. I have no
> idea at all where foam SInts are actually used in Foam.
The only written document I know is
http://axiom-portal.newsynthesis.org/refs/articles/foam.pdf
and there the size of SInt is not specified.
Ralf
More information about the Aldor-l
mailing list