[MLton] Debian: sparc works
Wesley W. Terpstra
Wed, 22 Dec 2004 15:19:24 +0100
On Tue, Dec 21, 2004 at 09:13:16PM -0800, Stephen Weeks wrote:
> > no typeof in C99 required changing some macros
> This is certainly the most annoying of the changes. What is the
> reason behind this? Is there really no workaround?
typeof is a keyword needing language support...
As far as I know, typeof is a GNU C language extension.
gcc's C99 support is strict, so removes non-standard features.
> Actually, that's OK. The SML basis used to distinguish between
> nanQuiet and nanSignalling but it doesn't any more.
> I propose to eliminate the distinction between those constants in the
> runtime, and to eliminate the __i386__ and __sun__ implementations of
> Real64_class, leaving only the C99 one.
I didn't do this mostly b/c I was trying to be conservative.
The comment about nanSignalling scared me. =)
> In fact, it might even be simpler to eliminate the C wrapper altogether,
> and call fpclassify directly from the basis library.
Be warned that fpclassify is a macro on many systems.
> BTW, why is there no C99 implementation for Real32_class?
Because the existing method appeared already portable. =)
fpclassify works for both float+double, so if you want to use it just
cut-and-paste the code for the switch on double.
> A couple more notes on comments you made in the patch.
> 1. Can you explain the following comment in runtime/types.h?
> /* !!! this stuff is all wrong: */
> typedef Int32 Int;
> typedef Real64 Real;
> typedef Word8 Char;
You assume that an Int is a 32-bit int. That's not the case on many
platforms. For alpha, 'int' in SML should be 64 bit! There are no
32-bit registers and doing 32-bit math requires emulation.
It gets even worse in the next section you didn't include.
Here are all sorts of assumptions about types:
Those are all assumptions which are wrong on at least one platform.
The '!!!' is something I put in places whenever I see a bug.
That was something I needed still to change to get 64bit platforms to work.
PS. C99 has 'bool' btw which is probably better to use than Int in C-codegen
Wesley W. Terpstra